Function datetimeToTimezoneString

  • import { datetimeToTimezoneString } from '@src/hylo-components/utils/usefull/usefull';

    Returns a datetime string in ISO format which can be safely parsed back into a Date object again. The string contains the timezone of the local machine if the timezone is not given.

    The date and time can be supplied as one string in the first and second parameter respectively instead of supplying each value separately.

    Parameters

    • year: string | number

      e.g. 2019 or 2019-08-05

    • Optional month: string | number

      e.g. 8 or 08 for august (starts counting at 1) or 03:02:09

    • Optional day: string | number

      e.g. 5 or 05

    • Optional hours: string | number

      e.g. 3 or 03

    • Optional minutes: string | number

      e.g. 2 or 02

    • Optional seconds: string | number

      e.g. 9 or 09

    • Optional timezone: string

      e.g. +01:00

    Returns string

    2019-08-05T03:02:09+01:00

Generated using TypeDoc