Sequelize ignores milliseconds part of DATETIME in MySQL
See original GitHub issueI’m using MySQL database with some columns of type DATETIME(3) (datetime with precision 3). Also in the entity model I have defined type as DATE(3). But after I set property of instance to time with millisecond part (e.g. entity.openedAt: “2015-08-29T08:39:08.12345Z”), sequelize generates SQL query, that truncates the millisecond part (…openedAt
=‘2015-08-29 08:39:08’…).
MySQL 5.6.4 and up expands fractional seconds support for TIME, DATETIME, and TIMESTAMP values, with up to microseconds (6 digits) precision.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Timestamp with a millisecond precision: How to save them in ...
You need to be at MySQL version 5.6.4 or later to declare columns with fractional-second time datatypes. Not sure you have the right...
Read more >Dialect-Specific Things - Sequelize
The underlying connector library used by Sequelize for MySQL is the mysql2 ... that has been idle for longer than the specified duration...
Read more >A Guide to Handling Date and Time for Full Stack JavaScript ...
Learn how to work with date and time values in JavaScript. ... Date.now(); // number of milliseconds since the Unix Epoch new Date()....
Read more >datetime comparison ignoring few milliseconds-sql-server
So depending on where exactly the rounding occurs, timestamps that differ by up to three milliseconds may be considered equal. Mureinik 281020. score:7....
Read more >Sequelize - how to format the date for date types values
The DATE type that converts to the SQL DATETIME format. The two types use the ISO standard to format the values they send...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In order to use millisecond-aware DATETIME columns, you’ll have to use
type: DataTypes.DATE(3)
+1 also having this problem using sequelize 3.19.2 when should this be working?
produces