LocalizedDate


title: constructor


title: LocaleDate

Classes

LocalizedDateClass

Functions

constructor(year, month, date, hours, minutes, seconds, milliseconds)

Typedefs

LocaleDateString

LocalizedDate ⇐ Class

Kind: global class
Extends: Class

LocalizedDate()

The LocalizedDate class generates extended date objects using the application level defined locales that are managed by the I18nManager

It supports uses LocaleDate static Classes (ex: LocaleDateEnGB) based on Moment.js locale format as defined in version 2.7.1

[ECMAScript standard Date API compliance](@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)

  • All “non deprecated” standard Date methods are available
  • Those that had “platform specific” behavior are stabilized
  • Those that generated “American representation” (ex: toString) use the application locale instead
  • The standard i18n related methods use the application locale

format([mask], [utc]) ⇒ string

Return a String representation of the current date.

Kind: instance method of LocalizedDate
Returns: string - The string representation of the date corresponding with the given mask.
See: LocalizedDate.format

ParamTypeDescription
[mask]string

The expected pattern ("ddd mmm dd yyyy HH:MM:ss" by default).

[utc]boolean

Optional. If true, the String will represent the current date in UTC time zone.

relativeTimeByNow() ⇒ string

Return a string that tell how many time is passed from now since the date, or how many time it remains to reach the date from now.

Kind: instance method of LocalizedDate
See: LocalizedDate.relativeTimeByNow
Example

"in a few seconds", "23 minutes ago", "in a month", "3 years ago",...

toLocaleString([options]) ⇒ string

Return a string with a language sensitive representation of this date.

In this LocalizedDate version the “locales” parameter is internally provided by the current I18n locale.

Kind: instance method of LocalizedDate
Experimental:
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString

ParamType
[options]Object

Example

"12/11/2012, 7:00:00 PM" (en-US) "20/12/2012 03:00:00" (en-GB) "2012. 12. 20. 오후 12:00:00" (ko-KR)

toLocaleDateString([options]) ⇒ string

Return a string with a language sensitive representation of the date portion of this date

In this LocalizedDate version the “locales” parameter is internally provided by the current I18n locale.

Kind: instance method of LocalizedDate
Experimental:
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString

ParamType
[options]Object

Example

"12/20/2012" (en-US) "20/12/2012" (en-GB) "2012. 12. 20." (ko-KR)

toLocaleTimeString([options]) ⇒ string

Return a string with a language sensitive representation of the time portion of this date.

In this LocalizedDate version the “locales” parameter is internally provided by the current I18n locale.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString

ParamType
[options]Object

Example

"7:00:00 PM" (en-US) "19:00:00" (en-GB) "오후 19:00:00" (ko-KR)

toString() ⇒ string

Shorthand for toLocaleString

This LocalizedDate change make all its instances converted in locale compliant string format for any string conversion operation

Kind: instance method of LocalizedDate
Warning: The native version returns a string in American English.
Todo

  • LocalizedDate may support an “options” property to event better customize default representation

Example

var localeDate = new LocalizedDate();
var output = 'Current Date: ' + localeDate;
// return: "Current Date: 12/11/2012, 7:00:00 PM" for en-US locale

toDateString() ⇒ string

Shorthand for toLocaleDateString

Kind: instance method of LocalizedDate
Warning: The native version returns a string in American English.

toTimeString() ⇒ string

Shorthand for toLocaleTimeString

Kind: instance method of LocalizedDate
Warning: The native version returns a string in American English.

toUTCString() ⇒ string

The toUTCString() method converts a date to a string, using the UTC time zone.

Kind: instance method of LocalizedDate
Warning: The native version is platform specific.

This Localized version is a shorthand to LocalizedDate.format(null, true)

toISOString() ⇒ string

The toISOString() method returns a string in simplified extended ISO format (ISO 8601), which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively).

The timezone is always zero UTC offset, as denoted by the suffix “Z”.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString

valueOf() ⇒ string

The valueOf() method returns the primitive value of a Date object as a number data type, which is the number of milliseconds since midnight 01 January, 1970 UTC (aka epoch ms).

This method is functionally equivalent to the getTime method. This method is usually called internally by JavaScript and not explicitly in code.

Kind: instance method of LocalizedDate
Returns: string - The number of milliseconds between 1 January 1970 00:00:00 UTC and the given date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toJSON

toJSON() ⇒ string

The toJSON() method returns an ISO string representation of the Date object.

Date instances refer to a specific point in time. Calling toJSON() returns a string (using toISOString()) representing the Date object’s value. This method is generally intended to, by default, usefully serialize Date objects during JSON serialization.

Kind: instance method of LocalizedDate
Returns: string - A string representation of the given date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toJSON

getTimezoneOffset() ⇒ number

The getTimezoneOffset() method returns the time zone difference, in minutes, from current locale (host system settings) to UTC.

The time-zone offset is the difference, in minutes, between UTC and local time. Note that this means that the offset is positive if the local timezone is behind UTC and negative if it is ahead.

Current LocaleUTC-8UTCUTC+3
Return Value4800-180

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset

getDay() ⇒ number

The getDay() method returns the day of the week for the specified date according to local time, where 0 represents Sunday.

An integer number corresponding to the day of the week for the given date, according to local time: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay

getUTCDay() ⇒ number

The getUTCDay() method returns the day of the week for the specified date according to universal time, where 0 represents Sunday.

An integer number corresponding to the day of the week for the given date, according to universal time: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCDay

getTime() ⇒ number

The getTime() method returns the numeric value corresponding to the time for the specified date according to universal time.

You can use this method to help assign a date and time to another Date object. This method is functionally equivalent to the valueOf() method.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime

setTime(msValue) ⇒ number

The setTime() method sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setTime

ParamTypeDescription
msValuenumber

An integer representing the number of milliseconds since 1 January 1970, 00:00:00 UTC.

getFullYear() ⇒ number

The getFullYear() method returns the year of the specified date according to local time.

A number corresponding to the year of the given date, according to local time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getFullYear

setFullYear(yearValue, [monthValue], [dayValue]) ⇒ number

The setFullYear() method sets the full year for a specified date according to local time. Returns new timestamp.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setFullYear

ParamTypeDescription
yearValuenumber

An integer specifying the numeric value of the year, for example, 1995.

[monthValue]number

An integer between 0 and 11 representing the months January through December.

[dayValue]number

An integer between 1 and 31 representing the day of the month. If you specify the dayValue parameter, you must also specify the monthValue.

getMonth() ⇒ number

The getMonth() method returns the month in the specified date according to local time, as a zero-based value (where zero indicates the first month of the year).

An integer number, between 0 and 11, representing the month in the given date according to local time. 0 corresponds to January, 1 to February, and so on.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMonth

setMonth(monthValue, [dayValue]) ⇒ number

The setMonth() method sets the month for a specified date according to the currently set year.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setMonth

ParamTypeDescription
monthValuenumber

An integer between 0 and 11 representing the months January through December.

[dayValue]number

An integer between 1 and 31 representing the day of the month. If you specify the dayValue parameter, you must also specify the monthValue.

getDate() ⇒ number

The getDate() method returns the day of the month for the specified date according to local time.

An integer number, between 1 and 31, representing the day of the month for the given date according to local time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDate

setDate(dayValue) ⇒ number

The setDate() method sets the day of the Date object relative to the beginning of the currently set month.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the given date (the Date object is also changed in place).
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setDate

ParamTypeDescription
dayValuenumber

An integer representing the day of the month.

getHours() ⇒ number

The getHours() method returns the hour for the specified date, according to local time.

An integer number, between 0 and 23, representing the hour for the given date according to local time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getHours

setHours(hoursValue, [minutesValue], [secondsValue], [msValue]) ⇒ number

The setHours() method sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setHours

ParamTypeDescription
hoursValuenumber

An integer between 0 and 23, representing the hour.

[minutesValue]number

An integer between 0 and 59, representing the minutes.

[secondsValue]number

An integer between 0 and 59, representing the seconds. If you specify the secondsValue parameter, you must also specify the minutesValue.

[msValue]number

A number between 0 and 999, representing the milliseconds. If you specify the msValue parameter, you must also specify the minutesValue and secondsValue.

getMinutes() ⇒ number

The getMinutes() method returns the minutes in the specified date according to local time.

An integer number, between 0 and 59, representing the minutes in the given date according to local time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMinutes

setMinutes(minutesValue, [secondsValue], [msValue]) ⇒ number

The setMinutes() method sets the minutes for a specified date according to local time.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setMinutes

ParamTypeDescription
minutesValuenumber

An integer between 0 and 59, representing the minutes.

[secondsValue]number

An integer between 0 and 59, representing the seconds. If you specify the secondsValue parameter, you must also specify the minutesValue.

[msValue]number

A number between 0 and 999, representing the milliseconds. If you specify the msValue parameter, you must also specify the minutesValue and secondsValue.

getSeconds() ⇒ number

The getSeconds() method returns the seconds in the specified date according to local time.

An integer number, between 0 and 59, representing the seconds in the given date according to local time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getSeconds

setSeconds(secondsValue, [msValue]) ⇒ number

The setSeconds() method sets the seconds for a specified date according to local time.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setSeconds

ParamTypeDescription
secondsValuenumber

An integer between 0 and 59, representing the seconds.

[msValue]number

A number between 0 and 999, representing the milliseconds. If you specify the msValue parameter, you must also specify the secondsValue.

getMilliseconds() ⇒ number

The getMilliseconds() method returns the milliseconds in the specified date according to local time.

A number, between 0 and 999, representing the milliseconds for the given date according to local time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMilliseconds

setMilliseconds(millisecondsValue) ⇒ number

The setMilliseconds() method sets the milliseconds for a specified date according to local time.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setMilliseconds

ParamTypeDescription
millisecondsValuenumber

A number between 0 and 999, representing the milliseconds.

getUTCFullYear() ⇒ number

The getUTCFullYear() method returns the year of the specified date according to universal time.

A number corresponding to the year of the given date, according to universal time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCFullYear

setUTCFullYear(yearValue, [monthValue], [dayValue]) ⇒ number

The setUTCFullYear() method sets the full year for a specified date according to universal time.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCFullYear

ParamTypeDescription
yearValuenumber

An integer specifying the numeric value of the year, for example, 1995.

[monthValue]number

An integer between 0 and 11 representing the months January through December.

[dayValue]number

An integer between 1 and 31 representing the day of the month. If you specify the dayValue parameter, you must also specify the monthValue.

getUTCMonth() ⇒ number

The getUTCMonth() method returns the month in the specified date according to universal time, as a zero-based value (where zero indicates the first month of the year).

An integer number, between 0 and 11, representing the month in the given date according to universal time. 0 corresponds to January, 1 to February, and so on.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCMonth

setUTCMonth(monthValue, [dayValue]) ⇒ number

The setUTCMonth() method sets the month for a specified date according to the currently set year.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCMonth

ParamTypeDescription
monthValuenumber

An integer between 0 and 11 representing the months January through December.

[dayValue]number

An integer between 1 and 31 representing the day of the month. If you specify the dayValue parameter, you must also specify the monthValue.

getUTCDate() ⇒ number

The getUTCDate() method returns the day (date) of the month in the specified date according to universal time.

An integer number, between 1 and 31, representing the day of the month for the given date according to universal time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCDate

setUTCDate(dayValue) ⇒ number

The setUTCDate() method sets the day of the month for a specified date according to universal time.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the given date (the Date object is also changed in place).
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCDate

ParamTypeDescription
dayValuenumber

An integer representing the day of the month.

getUTCHours() ⇒ number

The getUTCHours() method returns the hour for the specified date, according to universal time.

An integer number, between 0 and 23, representing the hour for the given date according to universal time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCHours

setUTCHours(hoursValue, [minutesValue], [secondsValue], [msValue]) ⇒ number

The setUTCHours() method sets the hours for a specified date according to universal time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCHours

ParamTypeDescription
hoursValuenumber

An integer between 0 and 23, representing the hour.

[minutesValue]number

An integer between 0 and 59, representing the minutes.

[secondsValue]number

An integer between 0 and 59, representing the seconds. If you specify the secondsValue parameter, you must also specify the minutesValue.

[msValue]number

A number between 0 and 999, representing the milliseconds. If you specify the msValue parameter, you must also specify the minutesValue and secondsValue.

getUTCMinutes() ⇒ number

The getUTCMinutes() method returns the minutes in the specified date according to universal time.

An integer number, between 0 and 59, representing the minutes in the given date according to universal time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCMinutes

setUTCMinutes(minutesValue, [secondsValue], [msValue]) ⇒ number

The setUTCMinutes() method sets the minutes for a specified date according to universal time.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCMinutes

ParamTypeDescription
minutesValuenumber

An integer between 0 and 59, representing the minutes.

[secondsValue]number

An integer between 0 and 59, representing the seconds. If you specify the secondsValue parameter, you must also specify the minutesValue.

[msValue]number

A number between 0 and 999, representing the milliseconds. If you specify the msValue parameter, you must also specify the minutesValue and secondsValue.

getUTCSeconds() ⇒ number

The getUTCSeconds() method returns the seconds in the specified date according to universal time.

An integer number, between 0 and 59, representing the seconds in the given date according to universal time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCSeconds

setUTCSeconds(secondsValue, [msValue]) ⇒ number

The setUTCSeconds() method sets the seconds for a specified date according to universal time.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCSeconds

ParamTypeDescription
secondsValuenumber

An integer between 0 and 59, representing the seconds.

[msValue]number

A number between 0 and 999, representing the milliseconds. If you specify the msValue parameter, you must also specify the secondsValue.

getUTCMilliseconds() ⇒ number

The getUTCMilliseconds() method returns the milliseconds in the specified date according to universal time.

A number, between 0 and 999, representing the milliseconds for the given date according to universal time.

Kind: instance method of LocalizedDate
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds

setUTCMilliseconds(millisecondsValue) ⇒ number

The setUTCMilliseconds() method sets the milliseconds for a specified date according to universal time.

Kind: instance method of LocalizedDate
Returns: number - The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds

ParamTypeDescription
millisecondsValuenumber

A number between 0 and 999, representing the milliseconds.

locale : LocaleDate | null

Current Locale definition

Kind: static property of LocalizedDate

ONE_SECOND : number

Value for one second in millisecond.

Kind: static constant of LocalizedDate

ONE_MINUTE : number

Value for one minute in millisecond.

Kind: static constant of LocalizedDate

ONE_HOUR : number

value for one hour in millisecond.

Kind: static constant of LocalizedDate

ONE_DAY : number

value for one day in millisecond.

Kind: static constant of LocalizedDate

ONE_WEEK : number

value for one week in millisecond.

Kind: static constant of LocalizedDate

ONE_YEAR : number

approximate value for one year in millisecond.

Kind: static constant of LocalizedDate

format([mask], [date], [utc]) ⇒ string

Return a String representation of the given or current date.

Kind: static method of LocalizedDate
Returns: string - The string representation of the date corresponding with the given mask.
Todo

  • Support a locale parameter on the static method (working only with loaded locales)
  • Support back token escapes via " or ’ (broken since using moment tokens) If you want to exclude some part of the string to be formatted, add some " or ‘. Example : ‘“Today at " h:mm’ will give something like “Today at 3:58”. ‘“Hello we are the " DD/MM/YYYY’ will give something like “Hello we are the 12/01/2017”.

A set of predefined formats is supported :

  • default: Thursday, September 4 1986 8:30 PM
  • shortDate: 9/04/1986
  • mediumDate: Sep 4 1986
  • longDate: September 4 1986
  • fullDate: Thursday, September 4 1986
  • shortTime: 8:30 PM
  • mediumTime: 8:30:25 PM
  • longTime: 8:30:25 PM GMT+0200
  • isoDate: 1986-09-04
  • isoTime: 20:30:25,
  • isoDateTime: 1986-09-04T20:30:25
  • isoUtcDateTime: 1986-09-04T18:30:25Z
ParamTypeDescription
[mask]string

The expected pattern ("ddd mmm dd yyyy HH:MM:ss" by default).

[date]Date | number

The given date (current date by default) as a Date object or a millisecond timestamp number

[utc]boolean

Optional. If true, the String will represent the current date in UTC time zone.

Example

LocalizedDate.format("isoDate") // 2017-05-21

Here is the list of token that will be formatted :
 - D    : day without padding. Examples : 1, 12,...
 - DD   : day with padding. Examples : 01, 12,...
 - dd   : week day in shortest format. Examples : Mo, Tu,...
 - ddd  : week day in short format. Examples : Mon, Tue,...
 - dddd : week day. Examples : Monday, Tuesday,...
 - M    : month number without padding. Examples : 1, 12,...
 - MM   : month number with padding. Examples : 01, 12,...
 - MMM  : month name in short format. Examples : Jan, Feb,...
 - MMMM : month name. Examples : January, February,...
 - YY   : Year in two digits. Examples : 89, 17,...
 - YYYY : Year in four digits. Examples : 1989, 2017,...
 - h    : hour without padding on 12h. Examples : 1, 12,...
 - hh   : hour with padding on 12h. Examples : 01, 12,...
 - H    : hour without padding on 24h. Examples : 0, 11,...
 - HH   : hour with padding on 24h. Examples : 0, 23,...
 - m    : minutes without padding. Examples : 0, 59,...
 - mm   : minutes with padding. Examples : 00, 59,...
 - s    : seconds without padding. Examples : 0, 59,...
 - ss   : seconds with padding. Examples : 00, 59,...
 - l    : milliseconds with padding on three digits. Examples : 000, 999,...
 - L    : milliseconds without padding on two digits. Examples : 0, 99,...
 - t    : post or ante meridian in one letter. Examples: a, p.
 - tt   : post or ante meridian in two letters. Examples: am, pm.
 - T    : post or ante meridian in one capital letter. Examples: A, P.
 - TT   : post or ante meridian in two capital letters. Examples: AM, PM.
 - Z    : Example: "GMT+0100"
 - o    : Example: "+0100"
 - S    : Examples: "st", "nd", "rd", "th", "".

values : LocalizedDate

Kind: inner property of format

relativeTimeByNow(date) ⇒ string

Return a localized string that tell how many time is passed from now since the provided date, or how many time it remains to reach this date from now.

Kind: static method of LocalizedDate

ParamTypeDescription
dateDate | number

Date or timestamp (UTC Unix Epoch time in milliseconds)

Example

"in a few seconds", "23 minutes ago", "in a month", "3 years ago",...

relativeTime(firstDate, secondDate) ⇒ string

Return a localized string that tell how many time is passed from firstDate since the secondDate, or how many time it remains to reach the secondDate from firstDate.

examples : “in a few seconds”, “23 minutes ago”, “in a month”, “3 years ago”,…

Kind: static method of LocalizedDate

ParamTypeDescription
firstDateDate | number

Date or timestamp (UTC Unix Epoch time in milliseconds)

secondDateDate | number

Date or timestamp (UTC Unix Epoch time in milliseconds)

constructor(year, month, date, hours, minutes, seconds, milliseconds)

Kind: global function

ParamTypeDescription
yearnumber

A defined year value (4 digits).

monthnumber

A defined month (2 digits).

datenumber

A defined day (2 digits).

hoursnumber

A defined number of hours (2 digits).

minutesnumber

A defined number of minutes (2 digits).

secondsnumber

A defined number of seconds (2 digits).

millisecondsnumber

A defined number of milliseconds (3 digits).

LocaleDate ⇒ String

Kind: global typedef
Returns: String - Locale date information like a JSON object.
Properties

NameTypeDescription
idString

An identifier of the locale (like en-GB notation using time based Localized format)

monthsArray.<String>

An array defining a list of Month.

monthsShortArray.<String>

An array defining a list of Month using short naming.

weekdaysArray.<String>

An array defining a list of Day.

weekdaysShortArray.<String>

An array defining a list of Day using short naming.

weekdaysMinArray.<String>

An array defining a list of Day with a minimal size.

longDateFormatObject.<String, String>

Various date formatting notations using long format.

calendarObject.<String, String>

Various date formatting notations using common sentences.

relativeTimeObject.<String, String>

Various relative date formatting notations using common sentences.

ordinalfunction

Function returning the day value with formatting.

weekObject.<String, String>

An object returning information on day notation within the week.