sequelize
Advanced tools
Comparing version 6.12.2 to 6.12.3
@@ -341,3 +341,5 @@ "use strict"; | ||
_stringify(date, options) { | ||
date = this._applyTimezone(date, options); | ||
if (!moment.isMoment(date)) { | ||
date = this._applyTimezone(date, options); | ||
} | ||
return date.format("YYYY-MM-DD HH:mm:ss.SSS Z"); | ||
@@ -344,0 +346,0 @@ } |
"use strict"; | ||
const moment = require("moment-timezone"); | ||
const momentTz = require("moment-timezone"); | ||
const moment = require("moment"); | ||
module.exports = (BaseTypes) => { | ||
@@ -170,3 +171,5 @@ const warn = BaseTypes.ABSTRACT.warn.bind(void 0, "https://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.db2.luw.sql.ref.doc/doc/r0008478.html"); | ||
_stringify(date, options) { | ||
date = this._applyTimezone(date, options); | ||
if (!moment.isMoment(date)) { | ||
date = this._applyTimezone(date, options); | ||
} | ||
if (this._length > 0) { | ||
@@ -188,3 +191,3 @@ let msec = "."; | ||
} | ||
value = new Date(moment.utc(value)); | ||
value = new Date(momentTz.utc(value)); | ||
return value; | ||
@@ -195,3 +198,3 @@ } | ||
static parse(value) { | ||
return moment(value).format("YYYY-MM-DD"); | ||
return momentTz(value).format("YYYY-MM-DD"); | ||
} | ||
@@ -198,0 +201,0 @@ } |
"use strict"; | ||
const wkx = require("wkx"); | ||
const _ = require("lodash"); | ||
const moment = require("moment-timezone"); | ||
const momentTz = require("moment-timezone"); | ||
const moment = require("moment"); | ||
module.exports = (BaseTypes) => { | ||
@@ -45,7 +46,6 @@ BaseTypes.ABSTRACT.prototype.dialectTypes = "https://mariadb.com/kb/en/library/resultset/#field-types"; | ||
_stringify(date, options) { | ||
if (_.isDate(date)) { | ||
if (!moment.isMoment(date)) { | ||
date = this._applyTimezone(date, options); | ||
return date.format("YYYY-MM-DD HH:mm:ss.SSS"); | ||
} | ||
return date; | ||
return date.format("YYYY-MM-DD HH:mm:ss.SSS"); | ||
} | ||
@@ -57,4 +57,4 @@ static parse(value, options) { | ||
} | ||
if (moment.tz.zone(options.timezone)) { | ||
value = moment.tz(value, options.timezone).toDate(); | ||
if (momentTz.tz.zone(options.timezone)) { | ||
value = momentTz.tz(value, options.timezone).toDate(); | ||
} else { | ||
@@ -61,0 +61,0 @@ value = new Date(`${value} ${options.timezone}`); |
"use strict"; | ||
const wkx = require("wkx"); | ||
const _ = require("lodash"); | ||
const moment = require("moment-timezone"); | ||
const momentTz = require("moment-timezone"); | ||
const moment = require("moment"); | ||
module.exports = (BaseTypes) => { | ||
@@ -45,10 +46,9 @@ BaseTypes.ABSTRACT.prototype.dialectTypes = "https://dev.mysql.com/doc/refman/5.7/en/data-types.html"; | ||
_stringify(date, options) { | ||
if (_.isDate(date)) { | ||
if (!moment.isMoment(date)) { | ||
date = this._applyTimezone(date, options); | ||
if (this._length) { | ||
return date.format("YYYY-MM-DD HH:mm:ss.SSS"); | ||
} | ||
return date.format("YYYY-MM-DD HH:mm:ss"); | ||
} | ||
return date; | ||
if (this._length) { | ||
return date.format("YYYY-MM-DD HH:mm:ss.SSS"); | ||
} | ||
return date.format("YYYY-MM-DD HH:mm:ss"); | ||
} | ||
@@ -60,4 +60,4 @@ static parse(value, options) { | ||
} | ||
if (moment.tz.zone(options.timezone)) { | ||
value = moment.tz(value, options.timezone).toDate(); | ||
if (momentTz.tz.zone(options.timezone)) { | ||
value = momentTz.tz(value, options.timezone).toDate(); | ||
} else { | ||
@@ -64,0 +64,0 @@ value = new Date(`${value} ${options.timezone}`); |
@@ -9,3 +9,3 @@ "use strict"; | ||
const dataTypes = require("../../data-types"); | ||
const moment = require("moment-timezone"); | ||
const momentTz = require("moment-timezone"); | ||
const { promisify } = require("util"); | ||
@@ -169,3 +169,3 @@ class ConnectionManager extends AbstractConnectionManager { | ||
if (!this.sequelize.config.keepDefaultTimezone) { | ||
const isZone = !!moment.tz.zone(this.sequelize.options.timezone); | ||
const isZone = !!momentTz.tz.zone(this.sequelize.options.timezone); | ||
if (isZone) { | ||
@@ -172,0 +172,0 @@ query += `SET TIME ZONE '${this.sequelize.options.timezone}';`; |
"use strict"; | ||
const moment = require("moment-timezone"); | ||
const momentTz = require("moment-timezone"); | ||
const moment = require("moment"); | ||
module.exports = (BaseTypes) => { | ||
@@ -31,3 +32,5 @@ BaseTypes.ABSTRACT.prototype.dialectTypes = "https://dev.snowflake.com/doc/refman/5.7/en/data-types.html"; | ||
_stringify(date, options) { | ||
date = this._applyTimezone(date, options); | ||
if (!moment.isMoment(date)) { | ||
date = this._applyTimezone(date, options); | ||
} | ||
if (this._length) { | ||
@@ -43,4 +46,4 @@ return date.format("YYYY-MM-DD HH:mm:ss.SSS"); | ||
} | ||
if (moment.tz.zone(options.timezone)) { | ||
value = moment.tz(value, options.timezone).toDate(); | ||
if (momentTz.tz.zone(options.timezone)) { | ||
value = momentTz.tz(value, options.timezone).toDate(); | ||
} else { | ||
@@ -47,0 +50,0 @@ value = new Date(`${value} ${options.timezone}`); |
@@ -472,3 +472,5 @@ 'use strict'; | ||
_stringify(date, options) { | ||
date = this._applyTimezone(date, options); | ||
if (!moment.isMoment(date)) { | ||
date = this._applyTimezone(date, options); | ||
} | ||
// Z here means current timezone, _not_ UTC | ||
@@ -475,0 +477,0 @@ return date.format('YYYY-MM-DD HH:mm:ss.SSS Z'); |
'use strict'; | ||
const moment = require('moment-timezone'); | ||
const momentTz = require('moment-timezone'); | ||
const moment = require('moment'); | ||
@@ -197,3 +198,6 @@ module.exports = BaseTypes => { | ||
_stringify(date, options) { | ||
date = this._applyTimezone(date, options); | ||
if (!moment.isMoment(date)) { | ||
date = this._applyTimezone(date, options); | ||
} | ||
if (this._length > 0) { | ||
@@ -215,3 +219,3 @@ let msec = '.'; | ||
} | ||
value = new Date(moment.utc(value)); | ||
value = new Date(momentTz.utc(value)); | ||
return value; | ||
@@ -223,3 +227,3 @@ } | ||
static parse(value) { | ||
return moment(value).format('YYYY-MM-DD'); | ||
return momentTz(value).format('YYYY-MM-DD'); | ||
} | ||
@@ -226,0 +230,0 @@ } |
@@ -5,3 +5,4 @@ 'use strict'; | ||
const _ = require('lodash'); | ||
const moment = require('moment-timezone'); | ||
const momentTz = require('moment-timezone'); | ||
const moment = require('moment'); | ||
@@ -58,8 +59,7 @@ module.exports = BaseTypes => { | ||
_stringify(date, options) { | ||
if (_.isDate(date)) { | ||
if (!moment.isMoment(date)) { | ||
date = this._applyTimezone(date, options); | ||
return date.format('YYYY-MM-DD HH:mm:ss.SSS'); | ||
} | ||
return date; | ||
return date.format('YYYY-MM-DD HH:mm:ss.SSS'); | ||
} | ||
@@ -71,4 +71,4 @@ static parse(value, options) { | ||
} | ||
if (moment.tz.zone(options.timezone)) { | ||
value = moment.tz(value, options.timezone).toDate(); | ||
if (momentTz.tz.zone(options.timezone)) { | ||
value = momentTz.tz(value, options.timezone).toDate(); | ||
} | ||
@@ -75,0 +75,0 @@ else { |
@@ -5,3 +5,5 @@ 'use strict'; | ||
const _ = require('lodash'); | ||
const moment = require('moment-timezone'); | ||
const momentTz = require('moment-timezone'); | ||
const moment = require('moment'); | ||
module.exports = BaseTypes => { | ||
@@ -57,12 +59,10 @@ BaseTypes.ABSTRACT.prototype.dialectTypes = 'https://dev.mysql.com/doc/refman/5.7/en/data-types.html'; | ||
_stringify(date, options) { | ||
if (_.isDate(date)) { | ||
if (!moment.isMoment(date)) { | ||
date = this._applyTimezone(date, options); | ||
// Fractional DATETIMEs only supported on MySQL 5.6.4+ | ||
if (this._length) { | ||
return date.format('YYYY-MM-DD HH:mm:ss.SSS'); | ||
} | ||
return date.format('YYYY-MM-DD HH:mm:ss'); | ||
} | ||
return date; | ||
// Fractional DATETIMEs only supported on MySQL 5.6.4+ | ||
if (this._length) { | ||
return date.format('YYYY-MM-DD HH:mm:ss.SSS'); | ||
} | ||
return date.format('YYYY-MM-DD HH:mm:ss'); | ||
} | ||
@@ -74,4 +74,4 @@ static parse(value, options) { | ||
} | ||
if (moment.tz.zone(options.timezone)) { | ||
value = moment.tz(value, options.timezone).toDate(); | ||
if (momentTz.tz.zone(options.timezone)) { | ||
value = momentTz.tz(value, options.timezone).toDate(); | ||
} | ||
@@ -78,0 +78,0 @@ else { |
@@ -10,3 +10,3 @@ 'use strict'; | ||
const dataTypes = require('../../data-types'); | ||
const moment = require('moment-timezone'); | ||
const momentTz = require('moment-timezone'); | ||
const { promisify } = require('util'); | ||
@@ -228,3 +228,3 @@ | ||
if (!this.sequelize.config.keepDefaultTimezone) { | ||
const isZone = !!moment.tz.zone(this.sequelize.options.timezone); | ||
const isZone = !!momentTz.tz.zone(this.sequelize.options.timezone); | ||
if (isZone) { | ||
@@ -231,0 +231,0 @@ query += `SET TIME ZONE '${this.sequelize.options.timezone}';`; |
'use strict'; | ||
const moment = require('moment-timezone'); | ||
const momentTz = require('moment-timezone'); | ||
const moment = require('moment'); | ||
module.exports = BaseTypes => { | ||
@@ -43,3 +45,5 @@ BaseTypes.ABSTRACT.prototype.dialectTypes = 'https://dev.snowflake.com/doc/refman/5.7/en/data-types.html'; | ||
_stringify(date, options) { | ||
date = this._applyTimezone(date, options); | ||
if (!moment.isMoment(date)) { | ||
date = this._applyTimezone(date, options); | ||
} | ||
if (this._length) { | ||
@@ -55,4 +59,4 @@ return date.format('YYYY-MM-DD HH:mm:ss.SSS'); | ||
} | ||
if (moment.tz.zone(options.timezone)) { | ||
value = moment.tz(value, options.timezone).toDate(); | ||
if (momentTz.tz.zone(options.timezone)) { | ||
value = momentTz.tz(value, options.timezone).toDate(); | ||
} | ||
@@ -59,0 +63,0 @@ else { |
{ | ||
"name": "sequelize", | ||
"description": "Sequelize is a promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Amazon Redshift and Snowflake’s Data Cloud. It features solid transaction support, relations, eager and lazy loading, read replication and more.", | ||
"version": "6.12.2", | ||
"version": "6.12.3", | ||
"funding": [ | ||
@@ -6,0 +6,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3854783
63542