Nutrient Web SDK
    Preparing search index...

    Type Alias DateTimeStringCallback

    DateTimeStringCallback: (
        args: {
            dateTime: Date;
            element: "COMMENT_THREAD" | "ANNOTATIONS_SIDEBAR";
            object: AnnotationsUnion | NutrientViewer.Comment;
        },
    ) => string

    Defining this callback allows you to customize how dates are rendered as part of the NutrientViewer UI.

    Type Declaration

      • (
            args: {
                dateTime: Date;
                element: "COMMENT_THREAD" | "ANNOTATIONS_SIDEBAR";
                object: AnnotationsUnion | NutrientViewer.Comment;
            },
        ): string
      • Parameters

        • args: {
              dateTime: Date;
              element: "COMMENT_THREAD" | "ANNOTATIONS_SIDEBAR";
              object: AnnotationsUnion | NutrientViewer.Comment;
          }
          • dateTime: Date

            The date to be formatted.

          • element: "COMMENT_THREAD" | "ANNOTATIONS_SIDEBAR"

            The NutrientViewer UI element on which the date is going to be rendered.

          • object: AnnotationsUnion | NutrientViewer.Comment

            The annotation or comment that contains the date that is being rendered.

        Returns string

    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);
    }
    }
    // ...
    });