dojox/main.relative (version 1.10)

Method Summary

  • format(dateObject,options) Format a Date object as a String, using locale-specific settings, relative to the current date or some other date.

Methods

format(dateObject,options)
Defined by dojox/date/relative

Format a Date object as a String, using locale-specific settings, relative to the current date or some other date.

Create a string from a Date object using the most significant information and a known localized pattern. This method formats both the date and time from dateObject. Formatting patterns are chosen appropriate to the locale.

If the day portion of the date falls within the current date (or the relativeDate option, if present), then the time will be all that is displayed

If the day portion of the date falls within the past week (or the week preceding relativeDate, if present), then the display will show day of week and time. This functionality can be turned off by setting weekCheck to false.

If the year portion of the date falls within the current year (or the year portion of relativeDate, if present), then the display will show month and day.

Otherwise, this function is equivalent to calling dojo.date.format with formatLength of "medium"

Parameter Type Description
dateObject Date

the date and time to be formatted.

options Object
Optional

An object with the following properties:

  • locale (String):

    override the locale used to determine formatting rules

  • relativeDate (Date):

    Date to calculate relation to (defaults to new Date())

  • weekCheck (boolean):

    Whether or not to display the day of week (defaults true)

Error in the documentation? Can’t find what you are looking for? Let us know!