Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix date parsing/validity check #2

Open
kraman opened this issue Jun 28, 2015 · 3 comments
Open

Fix date parsing/validity check #2

kraman opened this issue Jun 28, 2015 · 3 comments
Assignees

Comments

@kraman
Copy link
Contributor

kraman commented Jun 28, 2015

The tests are passing on CI, but this is in the console:

Deprecation warning: moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.
Error
    at deprecate (/Users/ryan/work/loopback-connector-sqlite3/node_modules/moment/moment.js:738:42)
    at /Users/ryan/work/loopback-connector-sqlite3/node_modules/moment/moment.js:826:50
    at /Users/ryan/work/loopback-connector-sqlite3/node_modules/moment/moment.js:8:85
    at Object.<anonymous> (/Users/ryan/work/loopback-connector-sqlite3/node_modules/moment/moment.js:11:2)
    at Module._compile (module.js:428:26)
    at Object.Module._extensions..js (module.js:446:10)
    at Module.load (module.js:353:32)
    at Function.Module._load (module.js:308:12)
    at Module.require (module.js:363:17)
    at require (module.js:382:17)
    at Object.<anonymous> (/Users/ryan/work/loopback-connector-sqlite3/lib/sqlite3.js:10:14)
    at Module._compile (module.js:428:26)
    at Object.Module._extensions..js (module.js:446:10)
    at Module.load (module.js:353:32)
    at Function.Module._load (module.js:308:12)
    at Module.require (module.js:363:17)
    at require (module.js:382:17)
    at Object.<anonymous> (/Users/ryan/work/loopback-connector-sqlite3/index.js:1:80)
    at Module._compile (module.js:428:26)
    at Object.Module._extensions..js (module.js:446:10)
    at Module.load (module.js:353:32)
    at Function.Module._load (module.js:308:12)
    at Module.require (module.js:363:17)
    at require (module.js:382:17)
    at global.getDataSource.global.getSchema (/Users/ryan/work/loopback-connector-sqlite3/test/init.js:6:27)
    at Context.<anonymous> (/Users/ryan/work/loopback-connector-sqlite3/test/sqlite.dbdefaults.test.js:10:10)
    at callFn (/Users/ryan/work/loopback-connector-sqlite3/node_modules/mocha/lib/runnable.js:266:21)
    at Hook.Runnable.run (/Users/ryan/work/loopback-connector-sqlite3/node_modules/mocha/lib/runnable.js:259:7)
    at next (/Users/ryan/work/loopback-connector-sqlite3/node_modules/mocha/lib/runner.js:271:10)
    at Immediate._onImmediate (/Users/ryan/work/loopback-connector-sqlite3/node_modules/mocha/lib/runner.js:292:5)
    at processImmediate [as _immediateCallback] (timers.js:371:17)
[Error: Invalid date default: '5']

edit: replaced deprecation with output from a non-coverage run of npm test

@kraman kraman self-assigned this Jun 28, 2015
@kraman
Copy link
Contributor Author

kraman commented Jun 28, 2015

/cc @rmg

@rmg
Copy link
Contributor

rmg commented Jun 29, 2015

Looking into this, it seems that using moment() for parsing arbitrary dates is actually no better than just using Date.parse().

In the processes of switching to a combination of Date.parse() and isNaN() checks on the result, I happened to discovered a bug.

@rmg
Copy link
Contributor

rmg commented Jun 29, 2015

Added comments on the initial PR - easier to reference this issue there and have them show up here than generate links to the relevant lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants