Registry / devops / posixtz

posixtz

JSON →
library1.0.0jsnpmunverified

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.

npm install posixtz
INSTALL
IMPORT
SIG · POSIXTZ
P
posixtz
devopsjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

formatPosixTZ
import { formatPosixTZ } from 'posixtz'
import posixtz from 'posixtz'
ESM named export; package also supports CommonJS require.
parsePosixTZ
const { parsePosixTZ } = require('posixtz')
const parsePosixTZ = require('posixtz')
CommonJS destructure needed because module exports object with multiple functions.
getOffsetForLocalDateWithPosixTZ
import { getOffsetForLocalDateWithPosixTZ } from 'posixtz'
Use named import in ESM.
formatLocalDateWithOffset
import { formatLocalDateWithOffset } from 'posixtz'
Use named import in ESM.

Shows all four exported functions: converting IANA to POSIX TZ, parsing back, computing offset, and formatting with offset.

import { formatPosixTZ, parsePosixTZ, getOffsetForLocalDateWithPosixTZ, formatLocalDateWithOffset } from 'posixtz'; import moment from 'moment'; import 'moment-timezone'; const iana = 'America/Los_Angeles'; const year = 2018; const posixStr = formatPosixTZ(iana, year); console.log(posixStr); // 'PST8PDT,M3.2.0,M11.1.0' const parsed = parsePosixTZ(posixStr); console.log(parsed.dstAbbr); // 'PDT' const offset = getOffsetForLocalDateWithPosixTZ('2018-03-11T02:00:00', posixStr); console.log(offset); // -420 (UTC-7) const formatted = formatLocalDateWithOffset('2018-03-11T02:00:00', posixStr); console.log(formatted); // '2018-03-11T02:00:00-07:00'
Debug
Known issues
gotchaPeer dependencies required: moment and moment-timezone must be installed separately.
fix
Run 'npm install posixtz moment moment-timezone'.
affects: >=1.0.0
breakingPackage does not ship TypeScript type definitions; users must create own or use @types/moment and @types/moment-timezone.
fix
Install @types/moment and @types/moment-timezone, and declare module types for posixtz.
affects: >=1.0.0
gotchaMoment.js is deprecated; future version may switch to Luxon/Intl but not yet implemented.
fix
Be prepared for potential breaking changes if dependency changes.
affects: >=1.0.0
gotchagetOffsetForLocalDateWithPosixTZ and formatLocalDateWithOffset expect date strings in a specific ISO-like format; may fail with other formats.
fix
Ensure input is 'YYYY-MM-DDTHH:mm:ss' format.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'posixtz'
Package not installed or peer dependencies missing cause runtime errors on import.
fix
Run 'npm install posixtz moment moment-timezone' in your project.
TypeError: moment(...).tz is not a function
moment-timezone not imported or not loaded.
fix
Add 'import 'moment-timezone';' or require('moment-timezone') before using posixtz functions.
Module not found: Error: Can't resolve 'posixtz'
Posixtz not in node_modules; peer dependencies installation may be incomplete.
fix
Check that posixtz and peer deps are all installed correctly.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
momentrequiredpeer dependency for time zone data and calculations
moment-timezonerequiredpeer dependency for IANA timezone data
Agent activity
6 hits · last 30 days
node
6
Resources
posixtz — npm install posixtz · libregistry