Class CronDate

CronDate class that wraps the Luxon DateTime object to provide a consistent API for working with dates and times in the context of cron.

Constructors

  • Constructs a new CronDate instance.

    Parameters

    • Optionaltimestamp: string | number | CronDate | Date

      The timestamp to initialize the CronDate with.

    • Optionaltz: string

      The timezone to use for the CronDate.

    Returns CronDate

Accessors

  • get dstEnd(): null | number
  • Returns daylight savings end time.

    Returns null | number

  • set dstEnd(value: null | number): void
  • Sets daylight savings end time.

    Parameters

    • value: null | number

    Returns void

  • get dstStart(): null | number
  • Returns daylight savings start time.

    Returns null | number

  • set dstStart(value: null | number): void
  • Sets daylight savings start time.

    Parameters

    • value: null | number

    Returns void

Methods

  • Adds one day to the current CronDate.

    Returns void

  • Adds one hour to the current CronDate.

    Returns void

  • Adds one minute to the current CronDate.

    Returns void

  • Adds one month to the current CronDate.

    Returns void

  • Adds one second to the current CronDate.

    Returns void

  • Adds a unit of time to the current CronDate.

    Parameters

    • unit: TimeUnit

    Returns void

  • Adds one year to the current CronDate.

    Returns void

  • Primarily for internal use.

    Parameters

    • op: DateMathOp

      The operation to perform.

    • unit: TimeUnit

      The unit of time to use.

    • OptionalhoursLength: number

      The length of the hours. Required when unit is not month or day.

    Returns void

  • Returns the day of the week.

    Returns number

  • Returns the year.

    Returns number

  • Returns the hour.

    Returns number

  • Returns the milliseconds.

    Returns number

  • Returns the minutes.

    Returns number

  • Returns the month.

    Returns number

  • Returns the seconds.

    Returns number

  • Returns the time.

    Returns number

  • Returns the UTC day.

    Returns number

  • Returns the UTC day of the week.

    Returns number

  • Returns the UTC year.

    Returns number

  • Returns the UTC hour.

    Returns number

  • Returns the UTC minutes.

    Returns number

  • Returns the UTC month.

    Returns number

  • Returns the UTC seconds.

    Returns number

  • Handles a math operation.

    Parameters

    • verb: DateMathOp

      {'add' | 'subtract'}

    • unit: TimeUnit

      {'year' | 'month' | 'day' | 'hour' | 'minute' | 'second'}

    Returns void

  • Returns true if the day is the last day of the month.

    Returns boolean

  • Returns true if the day is the last weekday of the month.

    Returns boolean

  • Sets the day.

    Parameters

    • d: number

    Returns void

  • Sets the day of the week.

    Parameters

    • d: number

    Returns void

  • Sets the year.

    Parameters

    • y: number

    Returns void

  • Sets the hour.

    Parameters

    • h: number

    Returns void

  • Sets the milliseconds.

    Parameters

    • s: number

    Returns void

  • Sets the minutes.

    Parameters

    • m: number

    Returns void

  • Sets the month.

    Parameters

    • m: number

    Returns void

  • Sets the seconds.

    Parameters

    • s: number

    Returns void

  • Subtracts one day from the current CronDate. If the day is 1, it will subtract one month instead.

    Returns void

  • Subtracts one hour from the current CronDate. If the hour is 0, it will subtract one day instead.

    Returns void

  • Subtracts one minute from the current CronDate. If the minute is 0, it will subtract one hour instead.

    Returns void

  • Subtracts one month from the current CronDate. If the month is 1, it will subtract one year instead.

    Returns void

  • Subtracts one second from the current CronDate. If the second is 0, it will subtract one minute instead.

    Returns void

  • Subtracts a unit of time from the current CronDate.

    Parameters

    • unit: TimeUnit

    Returns void

  • Subtracts one year from the current CronDate.

    Returns void

  • Returns the date as a Date object.

    Returns Date

  • Returns the UTC milliseconds.

    Returns null | string

  • Returns the date as a JSON string.

    Returns null | string

  • Returns the date as a string.

    Returns string