Options
All
  • Public
  • Public/Protected
  • All
Menu

An implementation for time zones using Intl.DateTimeFormat.

import { IntlTimezone } from '@jetblack/date-tz'

const tz = new IntlTimezone('Europe/Brussels')
const newYearsDay = tz.makeDate(2000, 0, 1)
// returns "2000-01-01T01:00:00Z"

Hierarchy

  • OffsetTimezone
    • IntlTimezone

Index

Constructors

  • Construct a timezone which uses the browser Intl.DateTimeFormat to discover timezone offsets.

    Parameters

    • name: string

    Returns IntlTimezone

Properties

formatDateTz: DateTimeFormat

Accessors

  • get name(): string
  • Get the name of the timezone.

    Returns string

Methods

  • Makes a new date by taking the date parts using this timezone and making the date with the supplied time zone.

    Parameters

    • date: Date

      A date

    • tz: Timezone

      A timezone

    Returns Date

    A new date using the date parts from this timezone, constructed with the supplied timezone.

  • day(date: Date): number
  • hours(date: Date): number
  • Parameters

    • date: Date

    Returns number

  • isDaylightSavings(date: Date): boolean
  • Parameters

    • date: Date

    Returns boolean

  • makeDate(year: number, month: number, day?: number, hours?: number, minutes?: number, seconds?: number, milliseconds?: number): Date
  • Parameters

    • year: number
    • month: number
    • Optional day: number
    • Optional hours: number
    • Optional minutes: number
    • Optional seconds: number
    • Optional milliseconds: number

    Returns Date

  • milliseconds(date: Date): number
  • Parameters

    • date: Date

    Returns number

  • minutes(date: Date): number
  • Parameters

    • date: Date

    Returns number

  • month(date: Date): number
  • Parameters

    • date: Date

    Returns number

  • offset(date: Date): number
  • Parameters

    • date: Date

    Returns number

  • seconds(date: Date): number
  • Parameters

    • date: Date

    Returns number

  • toISOString(date: Date): string
  • The ISO 8601 date string representation for a given date.

    Parameters

    • date: Date

      The date.

    Returns string

    The ISO date string.

  • weekday(date: Date): number
  • Parameters

    • date: Date

    Returns number

  • year(date: Date): number

Generated using TypeDoc