How to use the windows-iana.findOneIana function in windows-iana

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}"`)
    console.warn(

windows-iana

A small tool to convert between Windows time zones and IANA

MIT
Latest version published 3 years ago

Package Health Score

47 / 100
Full package analysis