Class Index | File Index

Classes


Class jsworld.DateTimeFormatter

Class for localised formatting of dates and times.

See: POSIX LC_TIME.
Defined in: <JsWorld.js>.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new date/time formatter for the specified locale.
Method Summary
Method Attributes Method Name and Description
 
formatDate(date, variant)
Formats a date according to the preset locale.
 
formatDateTime(date, variant)
Formats a date/time value according to the preset locale.
 
formatTime(date, variant)
Formats a time according to the preset locale.
Class Detail
jsworld.DateTimeFormatter(locale)
Creates a new date/time formatter for the specified locale.
Parameters:
{jsworld.Locale} locale
A locale object specifying the required POSIX LC_TIME formatting properties.
Throws:
Error on constructor failure.
Method Detail
{String} formatDate(date, variant)
Formats a date according to the preset locale.
Parameters:
{Date|String} date
A valid Date object instance or a string containing a valid ISO-8601 formatted date, e.g. "2010-31-03" or "2010-03-31 23:59:59".
{String} variant
Optional format variant, which can be "short" (using the d_fmt_short pattern), "medium" (d_fmt_medium), "long" (d_fmt_long) or "full" (d_fmt_full).
Throws:
Error on invalid date argument
Returns:
{String} The formatted date

{String} formatDateTime(date, variant)
Formats a date/time value according to the preset locale.
Parameters:
{Date|String} date
A valid Date object instance or a string containing a valid ISO-8601 formatted date/time, e.g. "2010-03-31 23:59:59".
{String} variant
Optional format variant, which can be "short" (using the d_t_fmt_short pattern), "medium" (d_t_fmt_medium), "long" (d_t_fmt_long) or "full" (d_t_fmt_full).
Throws:
Error on invalid argument.
Returns:
{String} The formatted time.

{String} formatTime(date, variant)
Formats a time according to the preset locale.
Parameters:
{Date|String} date
A valid Date object instance or a string containing a valid ISO-8601 formatted time, e.g. "23:59:59" or "2010-03-31 23:59:59".
{String} variant
Optional format variant, which can be "short" (using the t_fmt_short pattern), "medium" (t_fmt_medium), "long" (t_fmt_long) or "full" (t_fmt_full).
Throws:
Error on invalid date argument.
Returns:
{String} The formatted time.

Documentation generated by JsDoc Toolkit 2.4.0