← All Modules

Methods

date

format

format(date, format)

Parameters:

  • date
  • format

Formats the date. First argument can be a Date object or a date string. By default date is parsed to the YYYY-MM-DD format.

isostring

isostring(value)

Parameters:

  • value

Returns a string in simplified extended ISO format.

prettydate

prettydate(date, localization)

Parameters:

  • date
  • localization

Returns a string, that contains: the name of weekday, day of the month (from 1 to 31), name of the month, and year (four digits for dates between year 1000 and 9999). Localization can be "en-En" or "pl-Pl", in other case function throws error. By default localization equals "en-En".

timestamp

timestamp(date, pattern)

Parameters:

  • date
  • pattern

Returns a formatted date, based on the passed pattern.

hours

hours(date)

Parameters:

  • date

Returns the hours of the day (from 0 to 23) of the passed date.

minutes

minutes(date)

Parameters:

  • date

Returns the minutes of the hour (from 0 to 59) of the passed date.

seconds

seconds(date)

Parameters:

  • date

Returns the seconds of the minute (from 0 to 59) of the passed date.

day

day(date)

Parameters:

  • date

Returns the day of the month (from 1 to 31) of the passed date.

month

month(date)

Parameters:

  • date

Returns the month (from 0 to 11) of the passed date.

weekday

weekday(date)

Parameters:

  • date

Returns the day of the week (from 0 to 6) of the specified date.

year

year(date)

Parameters:

  • date

Returns the year of the passed date.

timeago

timeago(date)

Parameters:

  • date

Returns a human-readable string representing how long ago the date occurred (e.g., "2 hours ago", "3 days ago").