Skip to content

Commit

Permalink
Fix JavaScript parse reference date (#138)
Browse files Browse the repository at this point in the history
* Force build all modules on JavaScript build script

* Fix issue related to Date.parse implementation
  • Loading branch information
enzocano authored and tellarin committed Oct 12, 2017
1 parent 1554f7a commit b7d1d0d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
30 changes: 14 additions & 16 deletions JavaScript/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@ IF ERRORLEVEL 1 (
EXIT /B
)

IF NOT EXIST "node_modules" (
ECHO # Installing dependencies - npm install
CALL npm i
)
REM Prebuild each sub-module referenced on main module
ECHO.
ECHO # Building recognizers number module
CALL npm run prebuild-number

IF NOT EXIST "recognizers-number/node_modules" (
ECHO # Building recognizers number module
CALL npm run prebuild-number
)
ECHO.
ECHO # Building recognizers number-with-unit module
CALL npm run prebuild-number-with-unit

IF NOT EXIST "recognizers-number-with-unit/node_modules" (
ECHO # Building recognizers number-with-unit module
CALL npm run prebuild-number-with-unit
)
ECHO.
ECHO # Building recognizers date-time module
CALL npm run prebuild-date-time

IF NOT EXIST "recognizers-date-time/node_modules" (
ECHO # Building recognizers date-time module
CALL npm run prebuild-date-time
)
REM Build main module
ECHO.
ECHO # Installing dependencies - npm install
CALL npm i

ECHO.
ECHO # Building - npm run build
Expand Down
7 changes: 6 additions & 1 deletion JavaScript/test/runner-datetime.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,14 @@ function getModel(config) {
return findModel(options, cultureCode);
}

function parseISOLocal(s) {
var b = s.split(/\D/);
return new Date(b[0], b[1]-1, b[2], b[3], b[4], b[5]);
}

function getReferenceDate(testCase) {
if (testCase.Context && testCase.Context.ReferenceDateTime) {
return new Date(Date.parse(testCase.Context.ReferenceDateTime));
return parseISOLocal(testCase.Context.ReferenceDateTime);
}

return null;
Expand Down

0 comments on commit b7d1d0d

Please sign in to comment.