Skip to content

Commit

Permalink
fix: date string format (#243)
Browse files Browse the repository at this point in the history
fix #242
  • Loading branch information
JimmyDaddy authored and cyjake committed Dec 28, 2021
1 parent 975a252 commit ec8b489
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/data_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class BIGINT extends INTEGER {
}
}

const rDateFormat = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:[,.]\d{3,6})?$/;
const rDateFormat = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:[,.]\d{3,6})$/;

class DATE extends DataType {
constructor(precision, timezone = true) {
Expand Down
1 change: 1 addition & 0 deletions test/unit/data_types.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ describe('=> DataTypes type casting', function() {
assert.equal(new DATE().uncast(1625743838518).getTime(), 1625743838518);
assert.deepEqual(new DATE().uncast('2021-10-15 15:50:02,548'), new Date('2021-10-15T15:50:02.548Z'));
assert.deepEqual(new DATE().uncast('2021-10-15 15:50:02.548'), new Date('2021-10-15T15:50:02.548Z'));
assert.deepEqual(new DATE().uncast('2021-10-15 15:50:02'), new Date('2021-10-15 15:50:02'));

const today = new Date();
const result = new DATE(0).uncast(today);
Expand Down

0 comments on commit ec8b489

Please sign in to comment.