How to use timezonecomplete - 4 common examples

To help you get started, we’ve selected a few timezonecomplete examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MoveOnOrg / Spoke / src / lib / dst-helper.js View on Github external
static ensureTimezoneDstCalculated(timezone) {
    if (!(timezone in _timezoneOffsetAndDst)) {
      // If a location has DST, the offset from GMT at January 1 and June 1 will certainly
      // be different.  The greater of the two is the DST offset.  For our check, we
      // don't care when DST is (March-October in the northern hemisphere, October-March
      // in the southern hemisphere).  We only care about the offset during DST.
      const januaryDate = new DateTime(
        new Date().getFullYear(),
        1,
        1,
        0,
        0,
        0,
        0,
        zone(timezone)
      );
      const julyDate = new DateTime(
        new Date().getFullYear(),
        6,
        1,
        0,
        0,
        0,
github MoveOnOrg / Spoke / src / lib / dst-helper.js View on Github external
if (!(timezone in _timezoneOffsetAndDst)) {
      // If a location has DST, the offset from GMT at January 1 and June 1 will certainly
      // be different.  The greater of the two is the DST offset.  For our check, we
      // don't care when DST is (March-October in the northern hemisphere, October-March
      // in the southern hemisphere).  We only care about the offset during DST.
      const januaryDate = new DateTime(
        new Date().getFullYear(),
        1,
        1,
        0,
        0,
        0,
        0,
        zone(timezone)
      );
      const julyDate = new DateTime(
        new Date().getFullYear(),
        6,
        1,
        0,
        0,
        0,
        0,
        zone(timezone)
      );
      _timezoneOffsetAndDst[timezone] = new TimezoneOffsetAndDst(
        Math.min(januaryDate.offset(), julyDate.offset()),
        januaryDate.offset() !== julyDate.offset()
      );
    }
  }
github MoveOnOrg / Spoke / src / lib / dst-helper.js View on Github external
static isDateDst(date: Date, timezone: string): boolean {
    let d = new DateTime(date, DateFunctions.Get, zone(timezone));
    return DstHelper.isOffsetDst(d.offset(), timezone);
  }
github MoveOnOrg / Spoke / src / lib / dst-helper.js View on Github external
1,
        0,
        0,
        0,
        0,
        zone(timezone)
      );
      const julyDate = new DateTime(
        new Date().getFullYear(),
        6,
        1,
        0,
        0,
        0,
        0,
        zone(timezone)
      );
      _timezoneOffsetAndDst[timezone] = new TimezoneOffsetAndDst(
        Math.min(januaryDate.offset(), julyDate.offset()),
        januaryDate.offset() !== julyDate.offset()
      );
    }
  }

timezonecomplete

DateTime, TimeZone, Duration and Period library aimed at providing a consistent and complete date-time interface, away from the original JavaScript Date class.

MIT
Latest version published 6 months ago

Package Health Score

63 / 100
Full package analysis