Sampleviewer with dates will not work
[Update] Few bugs found:
createTime does not exist in Sample
I think there is a bug when selecting the renderer with the useSampleRenderer
.
The code causing problems is:
const datasetDate = parseDate(sample.createTime);
const viewerDate = parseDate(renderer.date);
if ((datasetDate?.getTime() || 0) < (viewerDate?.getTime() || 0)) {
return false;
}
sample.createTime does not exist, I believe modTime
should be used instead. Swagger link
Besides, I would rename the datasetDate but sampleDate or similar
The date field will depend on the definition order
Example: The same json in different order will produce different results:
01/04/2024 will be displayed
{
date: '01/04/2024',
beamline: 'BM29',
component: (props: any) => <>01/04/2024</>,
},
{
date: '01/01/2024',
beamline: 'BM29',
component: (props: any) => <>01/01/2024</>,
},
01/01/2024 will be displayed
{
date: '01/01/2024',
beamline: 'BM29',
component: (props: any) => <>01/01/2024</>,
},
{
date: '01/04/2024',
beamline: 'BM29',
component: (props: any) => <>01/04/2024</>,
},
Edited by Alejandro De Maria Antolinos