sequelize: Date format used for MSSQL dialect appears to be incorrect
Sequelize translates the Sequelize.DATE
type into DATETIME2
for MSSQL, but then proceeds to format dates in this format: 'YYYY-MM-DD HH:mm:ss.SSS Z'
.
MSSQL’s formats are as follows:
Data Type | Format |
---|---|
datetime |
YYYY-MM-DD hh:mm:ss[.nnn] |
datetime2 |
YYYY-MM-DD hh:mm:ss[.nnnnnnn] |
datetimeoffset |
`YYYY-MM-DD hh:mm:ss[.nnnnnnn] [+ |
(from https://msdn.microsoft.com/en-us/library/ms186724.aspx )
Since sequelize is including the offset when it shouldn’t be, was a datetimeoffset
type expected?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 19 (6 by maintainers)
something like this:
Fixed in https://github.com/sequelize/sequelize/pull/5274 to use
YYYY-MM-DD hh:mm:ss[.nnn]
(Yes, I know that datetime2 theoretically offers 6 digits of ms precision, but javascript doesn’t 😄)
Sequelize currently has this in
sql-string.js
:And this in
dialects/mssql/data-types.js
:Perhaps one should be changed to align with the other? (I’m not sure if there are any other areas that could be impacted by the change)