Registry / database / sequelize-date-no-tz-postgres

sequelize-date-no-tz-postgres

JSON →
library1.0.0jsnpmunverified

This package extends Sequelize to support the DATE_NO_TZ data type for PostgreSQL, enabling storage of timestamps without time zone (equivalent to PostgreSQL's timestamp without time zone). The current version is 1.0.0. It is a minimal utility that wraps Sequelize's DataTypes to add the missing DATE_NO_TZ type, addressing an open Sequelize issue. It is not actively maintained and has no updates since initial release. It is a simple drop-in solution for users who need to work with timestamps that ignore timezone conversion.

npm install sequelize-date-no-tz-postgres
INSTALL
IMPORT
SIG · SEQUELIZE-DATE-NO-
S
sequelize-date-no-tz-postgres
databasejavascriptv1.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.

withDateNoTz
const withDateNoTz = require('sequelize-date-no-tz-postgres');
import withDateNoTz from 'sequelize-date-no-tz-postgres';
This package is CommonJS only; ESM import will fail.
DATE_NO_TZ
const DataTypes = withDateNoTz(Sequelize.DataTypes); // then DataTypes.DATE_NO_TZ
const DataTypes = require('sequelize-date-no-tz-postgres')(Sequelize);
The function must be called with the Sequelize.DataTypes object, not the Sequelize constructor itself.
Sequelize.DATE_NO_TZ
const Sequelize = withDateNoTz(SequelizeBase); // then Sequelize.DATE_NO_TZ
Sequelize.DATE_NO_TZ without calling withDateNoTz first
In migrations, pass the Sequelize base to withDateNoTz to augment it with DATE_NO_TZ.

Demonstrates how to extend Sequelize DataTypes with DATE_NO_TZ and use it in a model definition. Shows import, initialization, and model creation.

const withDateNoTz = require('sequelize-date-no-tz-postgres'); const Sequelize = require('sequelize'); const sequelize = new Sequelize('database', 'username', 'password', { host: 'localhost', dialect: 'postgres' }); const DataTypes = withDateNoTz(Sequelize.DataTypes); const User = sequelize.define('User', { name: DataTypes.STRING, createdAt: DataTypes.DATE_NO_TZ }, { timestamps: true, createdAt: 'createdAt' }); // Now createdAt will be stored as timestamp without time zone User.sync({ force: true }).then(() => console.log('Synced'));
Debug
Known issues
gotchaDATE_NO_TZ only works with PostgreSQL dialect; using other dialects will silently fail or produce unexpected types.
fix
Ensure dialect is set to 'postgres' when instantiating Sequelize.
affects: >=1.0.0
gotchaThe package mutates the DataTypes object; calling withDateNoTz on the same object multiple times may add duplicate properties.
fix
Call withDateNoTz once and reuse the extended DataTypes object.
affects: >=1.0.0
deprecatedThis package is not compatible with Sequelize v6's TypeScript definitions; TypeScript users may need type assertions.
fix
Use type assertion like DataTypes.DATE_NO_TZ as any or define custom typings.
affects: >=1.0.0
gotchaDATE_NO_TZ does not automatically add timezone conversion; values inserted are assumed to be in the application's local time zone.
fix
Ensure dates are inserted as ISO strings without timezone or convert to UTC before insertion.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: DataTypes.DATE_NO_TZ is not a constructor
Using DATE_NO_TZ without calling withDateNoTz first.
fix
const DataTypes = withDateNoTz(Sequelize.DataTypes); then use DataTypes.DATE_NO_TZ.
SequelizeDatabaseError: type "date_no_tz" does not exist
Using a non-PostgreSQL dialect or incorrect column definition.
fix
Ensure dialect is 'postgres' and that the package is properly required and applied.
Cannot find module 'sequelize-date-no-tz-postgres'
Package not installed or typo in require path.
fix
npm install sequelize-date-no-tz-postgres
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Meta
2
Resources
sequelize-date-no-tz-postgres — npm install sequelize-date-no-tz-postgres · libregistry