Format date - Fluid Topics - Latest

Fluid Topics Designer Guide

Category
Reference Guides
Audience
public
Version
Latest

The format() method formats a date according to the format used by Fluid Topics.

For example:

// Format using custom options
const options = {
    locale: 'fr-FR',
    longFormat: true,
    withTime: true
};

formattedDate = FluidTopicsDateService.format("2024-09-27T12:34:56Z", options);
console.log('Formatted Date (custom options):', formattedDate);

The following table shows the different formatted dates for every possible combination of longFormat and withTime:

longFormat value withTime value Formatted date
false false 09/27/2024
false true 09/27/2024 12:34 PM
true false Sep 27, 2024
true true Sep 27, 2024, 12:34 PM
  • Both longFormat and withTime default to false.
  • locale defaults to the current UI locale.
  • Only en-US and the current UI locale are available as values for locale.