@@ -46,22 +46,24 @@ module.exports = (dateString, timezone) => {
46
46
} else if ( dateString . match ( / ^ f r o m ( .* ) t o ( .* ) $ / ) ) {
47
47
// eslint-disable-next-line no-unused-vars
48
48
const [ all , from , to ] = dateString . match ( / ^ f r o m ( .* ) t o ( .* ) $ / ) ;
49
- const fromResults = chrono . parse ( from , moment ( ) . tz ( timezone ) ) ;
50
- const toResults = chrono . parse ( to , moment ( ) . tz ( timezone ) ) ;
49
+ const fromResults = chrono . parse ( from , moment ( ) . tz ( timezone ) . format ( moment . HTML5_FMT . DATETIME_LOCAL_MS ) ) ;
50
+ const toResults = chrono . parse ( to , moment ( ) . tz ( timezone ) . format ( moment . HTML5_FMT . DATETIME_LOCAL_MS ) ) ;
51
51
if ( ! fromResults ) {
52
52
throw new UserError ( `Can't parse date: '${ from } '` ) ;
53
53
}
54
54
if ( ! toResults ) {
55
55
throw new UserError ( `Can't parse date: '${ to } '` ) ;
56
56
}
57
57
const exactGranularity = [ 'second' , 'minute' , 'hour' ] . find ( g => dateString . indexOf ( g ) !== - 1 ) || 'day' ;
58
+ console . log ( fromResults [ 0 ] . start ) ;
59
+ console . log ( toResults [ 0 ] . start ) ;
58
60
momentRange = [
59
61
momentFromResult ( fromResults [ 0 ] . start , timezone ) ,
60
62
momentFromResult ( toResults [ 0 ] . start , timezone )
61
63
] ;
62
64
momentRange = [ momentRange [ 0 ] . startOf ( exactGranularity ) , momentRange [ 1 ] . endOf ( exactGranularity ) ] ;
63
65
} else {
64
- const results = chrono . parse ( dateString , moment ( ) . tz ( timezone ) ) ;
66
+ const results = chrono . parse ( dateString , moment ( ) . tz ( timezone ) . format ( moment . HTML5_FMT . DATETIME_LOCAL_MS ) ) ;
65
67
if ( ! results ) {
66
68
throw new UserError ( `Can't parse date: '${ dateString } '` ) ;
67
69
}
0 commit comments