{"id":41746,"library":"posixtz","title":"posixtz","description":"POSIX time zone formatter and parser. Version 1.0.0, low release cadence. Converts between IANA time zones and POSIX TZ strings, and computes local offsets. Depends on moment and moment-timezone as peer dependencies. Differentiator: only npm package dedicated to POSIX TZ manipulation; relies on Moment.js ecosystem.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","posix","time","zone"],"install":[{"cmd":"npm install posixtz","lang":"bash","label":"npm"},{"cmd":"yarn add posixtz","lang":"bash","label":"yarn"},{"cmd":"pnpm add posixtz","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for time zone data and calculations","package":"moment","optional":false},{"reason":"peer dependency for IANA timezone data","package":"moment-timezone","optional":false}],"imports":[{"note":"ESM named export; package also supports CommonJS require.","wrong":"import posixtz from 'posixtz'","symbol":"formatPosixTZ","correct":"import { formatPosixTZ } from 'posixtz'"},{"note":"CommonJS destructure needed because module exports object with multiple functions.","wrong":"const parsePosixTZ = require('posixtz')","symbol":"parsePosixTZ","correct":"const { parsePosixTZ } = require('posixtz')"},{"note":"Use named import in ESM.","wrong":null,"symbol":"getOffsetForLocalDateWithPosixTZ","correct":"import { getOffsetForLocalDateWithPosixTZ } from 'posixtz'"},{"note":"Use named import in ESM.","wrong":null,"symbol":"formatLocalDateWithOffset","correct":"import { formatLocalDateWithOffset } from 'posixtz'"}],"quickstart":{"code":"import { formatPosixTZ, parsePosixTZ, getOffsetForLocalDateWithPosixTZ, formatLocalDateWithOffset } from 'posixtz';\nimport moment from 'moment';\nimport 'moment-timezone';\n\nconst iana = 'America/Los_Angeles';\nconst year = 2018;\nconst posixStr = formatPosixTZ(iana, year);\nconsole.log(posixStr); // 'PST8PDT,M3.2.0,M11.1.0'\n\nconst parsed = parsePosixTZ(posixStr);\nconsole.log(parsed.dstAbbr); // 'PDT'\n\nconst offset = getOffsetForLocalDateWithPosixTZ('2018-03-11T02:00:00', posixStr);\nconsole.log(offset); // -420 (UTC-7)\n\nconst formatted = formatLocalDateWithOffset('2018-03-11T02:00:00', posixStr);\nconsole.log(formatted); // '2018-03-11T02:00:00-07:00'","lang":"typescript","description":"Shows all four exported functions: converting IANA to POSIX TZ, parsing back, computing offset, and formatting with offset."},"warnings":[{"fix":"Run 'npm install posixtz moment moment-timezone'.","message":"Peer dependencies required: moment and moment-timezone must be installed separately.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Install @types/moment and @types/moment-timezone, and declare module types for posixtz.","message":"Package does not ship TypeScript type definitions; users must create own or use @types/moment and @types/moment-timezone.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Be prepared for potential breaking changes if dependency changes.","message":"Moment.js is deprecated; future version may switch to Luxon/Intl but not yet implemented.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure input is 'YYYY-MM-DDTHH:mm:ss' format.","message":"getOffsetForLocalDateWithPosixTZ and formatLocalDateWithOffset expect date strings in a specific ISO-like format; may fail with other formats.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':9 'cadenc':12 'comput':23 'convert':13 'dedic':40 'depend':26,35 'differenti':36 'ecosystem':48 'formatt':5 'iana':15 'javascript':49 'local':24 'low':10 'manipul':44 'moment':28,31 'moment-timezon':30 'moment.js':47 'npm':38 'offset':25 'packag':39 'parser':7 'peer':34 'posix':2,19,42,50 'posixtz':1 'releas':11 'reli':45 'string':21 'time':3,16,51 'timezon':32 'tz':20,43 'version':8 'zone':4,17,52","created_at":"2026-06-04T18:53:54.473382+00:00","updated_at":"2026-06-04T18:53:54.473382+00:00","problems":[{"fix":"Run 'npm install posixtz moment moment-timezone' in your project.","cause":"Package not installed or peer dependencies missing cause runtime errors on import.","error":"Cannot find module 'posixtz'"},{"fix":"Add 'import 'moment-timezone';' or require('moment-timezone') before using posixtz functions.","cause":"moment-timezone not imported or not loaded.","error":"TypeError: moment(...).tz is not a function"},{"fix":"Check that posixtz and peer deps are all installed correctly.","cause":"Posixtz not in node_modules; peer dependencies installation may be incomplete.","error":"Module not found: Error: Can't resolve 'posixtz'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"posixtz","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}