File tree 1 file changed +11
-10
lines changed
1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,9 @@ module.exports = function () {
54
54
case 'date' :
55
55
return 'DATE'
56
56
case 'datetime' :
57
- return property . timezone === 'ignore'
58
- ? 'DATETIME2 '
59
- : 'DATETIMEOFFSET '
57
+ return property . timezone === true
58
+ ? 'DATETIMEOFFSET '
59
+ : 'DATETIME2 '
60
60
default :
61
61
return 'NVARCHAR(' + ( property . maxLength || 'MAX' ) + ')'
62
62
}
@@ -304,17 +304,18 @@ module.exports = function () {
304
304
)
305
305
}
306
306
307
- adapter . getCoercionFunction = function ( type , timezone ) {
307
+ adapter . getCoercionFunction = function ( type ) {
308
308
switch ( type ) {
309
309
case 'datetime' :
310
310
return function ( value ) {
311
- if ( typeof value === 'string' ) {
312
- if ( timezone !== 'ignore' && ! value . includes ( 'Z' ) ) {
313
- value += 'Z'
314
- }
315
- return new Date ( value )
311
+ if ( typeof value === 'string' && ! value . endsWith ( 'Z' ) && ! value . match ( / [ - | + ] \d \d : \d \d $ / ) ) {
312
+ value = value + 'Z'
316
313
}
317
- return value
314
+ return new Date ( value )
315
+ }
316
+ case 'date' :
317
+ return function ( value ) {
318
+ return value . slice ( 0 , 10 )
318
319
}
319
320
case 'integer' :
320
321
return Number
You can’t perform that action at this time.
0 commit comments