$a.dateTime

đŸ“˜

Contains methods for date/time transformation.

utcToLocal

utcToLocal(dateStr: string | Date, zoneOffset?: number): string

Transforms UTC date to local date.

Params

  • dateStr - string with date or Date
  • zoneOffset - (optional) zone offset. If not provided then current device zoneOffset is used.

Example

let localDateString = this.$a.dateTime.utcToLocal("2023-01-01T13:00:00.000Z")

localToUtc

localToUtc(dateStr: string | Date): string

Transforms local date to UTC date.

Params

  • dateStr - string with date or Date

Example

let utcDateString = this.$a.dateTime.localToUtc("2023-01-01T13:00:00.000")