How to use windows-iana - 3 common examples

To help you get started, we’ve selected a few windows-iana 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 capaj / set-tz / index.js View on Github external
module.exports = (TZ) => {
  let winTz
  let ianaTz
  if (TZ !== 'UTC') {
    winTz = ianaWin.findWindows(TZ)
    ianaTz = ianaWin.findOneIana(TZ)

    if (!winTz && !ianaTz) {
      throw new Error(
        `The timezone - ${TZ} - does not exist. Please provide a valid Windows or IANA time.`
      )
    }
  }

  if (os.platform() === 'win32') {
    const previousTZ = execSync('tzutil /g').toString()
    const cleanup = () => {
      execSync(`tzutil /s "${previousTZ}"`)
      console.log(`timezone was restored to ${previousTZ}`)
    }
    execSync(`tzutil /s "${winTz || TZ}"`)
github capaj / set-tz / index.js View on Github external
module.exports = (TZ) => {
  let winTz
  let ianaTz
  if (TZ !== 'UTC') {
    winTz = ianaWin.findWindows(TZ)
    ianaTz = ianaWin.findOneIana(TZ)

    if (!winTz && !ianaTz) {
      throw new Error(
        `The timezone - ${TZ} - does not exist. Please provide a valid Windows or IANA time.`
      )
    }
  }

  if (os.platform() === 'win32') {
    const previousTZ = execSync('tzutil /g').toString()
    const cleanup = () => {
      execSync(`tzutil /s "${previousTZ}"`)
      console.log(`timezone was restored to ${previousTZ}`)
    }
    execSync(`tzutil /s "${winTz || TZ}"`)
    console.warn(
github jitsi / jitsi-meet / react / features / calendar-sync / web / microsoftCalendar.js View on Github external
client,
        calendarId,
        fetchStartDays,
        fetchEndDays): Promise<*> {
    const startDate = new Date();
    const endDate = new Date();

    startDate.setDate(startDate.getDate() + fetchStartDays);
    endDate.setDate(endDate.getDate() + fetchEndDays);

    const filter = `Start/DateTime ge '${
        startDate.toISOString()}' and End/DateTime lt '${
        endDate.toISOString()}'`;

    const ianaTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
    const windowsTimeZone = findWindows(ianaTimeZone);

    return client
        .api(`/me/calendars/${calendarId}/events`)
        .filter(filter)
        .header('Prefer', `outlook.timezone="${windowsTimeZone}"`)
        .select('id,subject,start,end,location,body')
        .orderby('createdDateTime DESC')
        .get()
        .then(result => result.value.map(item => {
            return {
                ...item,
                calendarId
            };
        }));
}

windows-iana

A small tool to convert between Windows time zones and IANA

MIT
Latest version published 2 years ago

Package Health Score

47 / 100
Full package analysis