Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize Date source string when parsing (#609)
* Normalize source string when parsing The regex used to parse dates does not account for the fact that new dates created by SQLite's CURRENT_TIMESTAMP do not include millisecond information. The regex used by the date parser tries to find a string matching "yyyy-MM-dd HH:mm:ss.SSS" but the dates created by SQLite do not include the milliseconds (.SSS) so the date strings are not matching and this is causing the parser to return null. The solution is to detect this exact case (string length is exactly 19) and then append .000 to the source string. This causes the regex to match on the string. allowing the date string to be parsed, and the Date object to be returned. The source object is not mutated, and the extra characters do not change the DATETIME represented by the date string, so I think this is a safe fix. * Add unit test for default datetime
- Loading branch information