Provides date manipulation and formatting functions for use in HotMesh mapping rules. Although inspired by JavaScript's Date API, these methods follow a functional approach where each transformation expects one or more input parameters from the prior row in the @pipe structure.

Many methods accept various input formats (Date, string, and number), implicitly casting to dates as necessary. The ISO 8601 Extended Format is supported, including date strings like YYYY-MM-DD, YYYY-MM-DDTHH:mm:ss, and YYYY-MM-DDTHH:mm:ss.sssZ. Strings or numbers representing milliseconds since the Unix epoch are also accepted.

Methods are invoked as {@date.<method>}, e.g., {@date.now} or {@date.getFullYear}.

Constructors

Methods

  • Creates a new Date object from a string representation of a date in ISO 8601 format.

    Parameters

    • isoString: string

      An ISO 8601 date string (e.g., "2023-04-23T12:00:00.000Z").

    Returns Date

    A Date object corresponding to the provided ISO string.

    date_obj:
    "@pipe":
    - ["{a.output.data.isoDate}"]
    - ["{@date.fromISOString}"]
  • Returns the day of the month (1--31) for the specified date according to local time.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The day of the month (1--31).

    day_of_month:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getDate}"]
  • Returns the day of the week (0--6, where 0 is Sunday) for the specified date according to local time.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The day of the week (0 = Sunday, 6 = Saturday).

    day_of_week:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getDay}"]
  • Returns the full year (4 digits) for the specified date according to local time.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The four-digit year.

    full_year:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getFullYear}"]
  • Returns the hour (0--23) for the specified date according to local time.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The hour (0--23).

    hour:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getHours}"]
  • Returns the milliseconds (0--999) for the specified date according to local time.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The milliseconds component (0--999).

    milliseconds:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getMilliseconds}"]
  • Returns the minutes (0--59) for the specified date according to local time.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The minutes component (0--59).

    minutes:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getMinutes}"]
  • Returns the month (0--11, where 0 is January) for the specified date according to local time.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The month (0 = January, 11 = December).

    month:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getMonth}"]
  • Returns the seconds (0--59) for the specified date according to local time.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The seconds component (0--59).

    seconds:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getSeconds}"]
  • Returns the number of milliseconds since January 1, 1970, 00:00:00 UTC for the specified date.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    Milliseconds since the Unix epoch.

    time:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getTime}"]
  • Returns the time zone difference, in minutes, from the current locale (host system settings) to UTC.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The timezone offset in minutes.

    timezone_offset:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getTimezoneOffset}"]
  • Returns the day of the month (1--31) for the specified date according to universal time (UTC).

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The UTC day of the month (1--31).

    utc_day:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getUTCDate}"]
  • Returns the day of the week (0--6, where 0 is Sunday) for the specified date according to universal time (UTC).

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The UTC day of the week (0 = Sunday, 6 = Saturday).

    utc_weekday:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getUTCDay}"]
  • Returns the year of the specified date according to universal time (UTC).

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The four-digit UTC year.

    utc_year:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getUTCFullYear}"]
  • Returns the hours (0--23) of the specified date according to universal time (UTC).

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The UTC hours (0--23).

    utc_hours:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getUTCHours}"]
  • Returns the milliseconds (0--999) of the specified date according to universal time (UTC).

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The UTC milliseconds (0--999).

    utc_milliseconds:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getUTCMilliseconds}"]
  • Returns the minutes (0--59) of the specified date according to universal time (UTC).

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The UTC minutes (0--59).

    utc_minutes:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getUTCMinutes}"]
  • Returns the month (0--11) of the specified date according to universal time (UTC), where 0 is January and 11 is December.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The UTC month (0 = January, 11 = December).

    utc_month:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getUTCMonth}"]
  • Returns the seconds (0--59) of the specified date according to universal time (UTC).

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    The UTC seconds (0--59).

    utc_seconds:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.getUTCSeconds}"]
  • Returns the current time in milliseconds since the Unix epoch (January 1, 1970 00:00:00 UTC). Takes no parameters.

    Returns number

    The current timestamp in milliseconds.

    current_time:
    "@pipe":
    - ["{@date.now}"]
  • Parses a string representation of a date and returns the number of milliseconds since the Unix epoch (January 1, 1970 00:00:00 UTC).

    Parameters

    • dateString: string

      A date string to parse (e.g., "April 23, 2023 12:00:00").

    Returns number

    Milliseconds since the Unix epoch for the given date string.

    date_milliseconds:
    "@pipe":
    - ["{a.output.data.dateString}"]
    - ["{@date.parse}"]
  • Sets the day of the month (1--31) of a date object according to local time. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • day: number

      The day of the month to set (1--31).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 15]
    - ["{@date.setDate}"]
  • Sets the full year of a date object according to local time, with optional month and day parameters. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • year: number

      The full year value to set.

    • Optionalmonth: number

      Optional month to set (0--11).

    • Optionalday: number

      Optional day of the month to set (1--31).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 2024]
    - ["{@date.setFullYear}"]
  • Sets the hours (0--23) of a date object according to local time, with optional minutes, seconds, and milliseconds. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • hours: number

      The hours value to set (0--23).

    • Optionalminutes: number

      Optional minutes to set (0--59).

    • Optionalseconds: number

      Optional seconds to set (0--59).

    • Optionalms: number

      Optional milliseconds to set (0--999).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 15]
    - ["{@date.setHours}"]
  • Sets the milliseconds value (0--999) of a date object according to local time and returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • ms: number

      The milliseconds value to set (0--999).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 123]
    - ["{@date.setMilliseconds}"]
  • Sets the minutes value (0--59) of a date object according to local time, with optional seconds and milliseconds. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • minutes: number

      The minutes value to set (0--59).

    • Optionalseconds: number

      Optional seconds value to set (0--59).

    • Optionalms: number

      Optional milliseconds value to set (0--999).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 45, 30]
    - ["{@date.setMinutes}"]
  • Sets the month value (0--11) of a date object according to local time, with an optional day of the month. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • month: number

      The month value to set (0 = January, 11 = December).

    • Optionalday: number

      Optional day of the month to set (1--31).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 7, 15]
    - ["{@date.setMonth}"]
  • Sets the seconds value (0--59) of a date object according to local time, with optional milliseconds. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • seconds: number

      The seconds value to set (0--59).

    • Optionalms: number

      Optional milliseconds value to set (0--999).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 30, 123]
    - ["{@date.setSeconds}"]
  • Sets the date object to the time represented by the number of milliseconds since January 1, 1970, 00:00:00 UTC. Returns the new timestamp.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • time: number

      The number of milliseconds since the Unix epoch.

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 1620000000000]
    - ["{@date.setTime}"]
  • Sets the day of the month (1--31) of a date object according to universal time (UTC). Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • day: number

      The UTC day of the month to set (1--31).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 15]
    - ["{@date.setUTCDate}"]
  • Sets the full year of a date object according to universal time (UTC), with optional month and day parameters. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • year: number

      The UTC full year value to set.

    • Optionalmonth: number

      Optional UTC month to set (0--11).

    • Optionalday: number

      Optional UTC day of the month to set (1--31).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 2025]
    - ["{@date.setUTCFullYear}"]
  • Sets the hours (0--23) of a date object according to universal time (UTC), with optional minutes, seconds, and milliseconds. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • hours: number

      The UTC hours value to set (0--23).

    • Optionalminutes: number

      Optional UTC minutes to set (0--59).

    • Optionalseconds: number

      Optional UTC seconds to set (0--59).

    • Optionalms: number

      Optional UTC milliseconds to set (0--999).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 18]
    - ["{@date.setUTCHours}"]
  • Sets the milliseconds value (0--999) of a date object according to universal time (UTC). Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • ms: number

      The UTC milliseconds value to set (0--999).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 500]
    - ["{@date.setUTCMilliseconds}"]
  • Sets the minutes value (0--59) of a date object according to universal time (UTC), with optional seconds and milliseconds. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • minutes: number

      The UTC minutes value to set (0--59).

    • Optionalseconds: number

      Optional UTC seconds to set (0--59).

    • Optionalms: number

      Optional UTC milliseconds to set (0--999).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 45]
    - ["{@date.setUTCMinutes}"]
  • Sets the month value (0--11) of a date object according to universal time (UTC), with an optional day parameter. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • month: number

      The UTC month value to set (0 = January, 11 = December).

    • Optionalday: number

      Optional UTC day of the month to set (1--31).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 2]
    - ["{@date.setUTCMonth}"]
  • Sets the seconds value (0--59) of a date object according to universal time (UTC), with an optional milliseconds parameter. Returns the new timestamp in milliseconds.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • seconds: number

      The UTC seconds value to set (0--59).

    • Optionalms: number

      Optional UTC milliseconds to set (0--999).

    Returns number

    The updated timestamp in milliseconds since epoch.

    new_date:
    "@pipe":
    - ["{a.output.data.date}", 30]
    - ["{@date.setUTCSeconds}"]
  • Returns the date portion of a date object in a human-readable form as a string (e.g., "Sun Apr 23 2023").

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns string

    The date portion as a human-readable string.

    date_string:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.toDateString}"]
  • Returns the date object as a string in ISO 8601 format (e.g., "2023-04-23T12:34:56.000Z").

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns string

    The date as an ISO 8601 string.

    iso_date:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.toISOString}"]
  • Returns an ISO date (or current date if none provided) as a string formatted as a compact decimal (e.g., "20240423123456.789"). This is useful for sorting dates in string format while keeping the output more human-friendly than date.valueOf. Uses the formatISODate utility internally.

    Parameters

    • Optionaldate: DateInput

      Optional date value (ISO string, milliseconds, or Date). Defaults to now.

    Returns string

    The date formatted as a compact decimal string.

    formatted_date:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.toISOXString}"]
  • Returns the date object as a string in a JSON-compatible format, which is similar to the ISO 8601 format.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns string

    The date as a JSON-compatible string.

    json_date:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.toJSON}"]
  • Returns the date object as a string formatted according to the given locale(s) and formatting options, showing only the date portion.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • Optionallocales: string | string[]

      Optional locale string or array of locale strings (e.g., "en-US").

    • Optionaloptions: DateTimeFormatOptions

      Optional formatting options.

    Returns string

    The localized date string.

    localized_date:
    "@pipe":
    - ["{a.output.data.date}", "en-US"]
    - ["{@date.toLocaleDateString}"]
  • Returns the date object as a string formatted according to the given locale(s) and formatting options, including both date and time portions.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • Optionallocales: string | string[]

      Optional locale string or array of locale strings (e.g., "en-US").

    • Optionaloptions: DateTimeFormatOptions

      Optional formatting options.

    Returns string

    The localized date and time string.

    localized_date_time:
    "@pipe":
    - ["{a.output.data.date}", "en-US"]
    - ["{@date.toLocaleString}"]
  • Returns the time portion of a date object as a string formatted according to the given locale(s) and formatting options.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    • Optionallocales: string | string[]

      Optional locale string or array of locale strings (e.g., "en-US").

    • Optionaloptions: DateTimeFormatOptions

      Optional formatting options.

    Returns string

    The localized time string.

    localized_time:
    "@pipe":
    - ["{a.output.data.date}", "en-US"]
    - ["{@date.toLocaleTimeString}"]
  • Converts a date object to a string using the default formatting for the local time zone.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns string

    The date and time as a string in the local time zone.

    date_string:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.toString}"]
  • Returns the number of milliseconds since January 1, 1970, 00:00:00 UTC for the given date components. Accepts between two and seven parameters.

    Parameters

    • year: number

      The full year (e.g., 2023).

    • month: number

      The month (0 = January, 11 = December).

    • Optionaldate: number

      Optional day of the month (1--31).

    • Optionalhours: number

      Optional hours (0--23).

    • Optionalminutes: number

      Optional minutes (0--59).

    • Optionalseconds: number

      Optional seconds (0--59).

    • Optionalms: number

      Optional milliseconds (0--999).

    Returns number

    Milliseconds since the Unix epoch for the given UTC date components.

    milliseconds_since_epoch:
    "@pipe":
    - ["{a.output.data.year}", "{a.output.data.month}", "{a.output.data.day}"]
    - ["{@date.UTC}"]
  • Returns the numeric value of the specified date object as the number of milliseconds since January 1, 1970, 00:00:00 UTC.

    Parameters

    • date: DateInput

      A date value (ISO string, milliseconds, or Date).

    Returns number

    Milliseconds since the Unix epoch.

    milliseconds_since_epoch:
    "@pipe":
    - ["{a.output.data.date}"]
    - ["{@date.valueOf}"]
  • Returns today's date formatted as a YYYY-MM-DD string using UTC. Takes no parameters, similar to date.now.

    Returns string

    Today's date in YYYY-MM-DD format.

    today:
    "@pipe":
    - ["{@date.yyyymmdd}"]
  • Converts a date input (ISO string, milliseconds, or Date instance) into a native Date object. This static helper centralises the parsing logic used by every other DateHandler method, allowing concise mapping rules that avoid date-initialisation boilerplate.

    Parameters

    • input: DateInput

      A date value as an ISO 8601 string, numeric milliseconds since epoch, or an existing Date instance.

    Returns Date

    A native Date object corresponding to the input.

    const d = DateHandler.getDateInstance('2023-04-23T12:00:00.000Z');