The date to be formatted.
The NutrientViewer UI element on which the date is going to be rendered.
The annotation or comment that contains the date that is being rendered.
NutrientViewer.load({
dateTimeString: ({ dateTime, element }) => {
if(element === NutrientViewer.UIDateTimeElement.ANNOTATIONS_SIDEBAR) {
return new Intl.DateTimeFormat("en-US", {
dateStyle: "short",
timeStyle: "short",
}).format(dateTime);
} else {
return new Intl.DateTimeFormat("en-US", {
dateStyle: "full",
timeStyle: "long",
}).format(dateTime);
}
}
// ...
});
Defining this callback allows you to customize how dates are rendered as part of the NutrientViewer UI.