-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Good afternoon,
Neato project you've got here.
We've been using this tool in one of our apps to automagically guess the format required to use moment with arbitrary datetime strings.
I ran into an issue with ver 1.0.10 and 1.2.4 of moment-guess while using node 12.13.0
when calling any of:
momentGuess('2017-11-07T15:12:37.121Z')
momentGuess('2017-11-07T15:12:37.121')
momentGuess('2017-11-07T15:12:37')
momentGuess('2017-11-07T15:12')
then the resulting guess is:
DD--T:mmMMHHYYYY
After some time switching versions and checking some other areas of the app, I decided to give this repo's own unit tests a whirl
git clone git@github.com:apoorv-mishra/moment-guess.git
nvm use 12.13.0
npm install
npm test
Test Suites: 6 failed, 6 total
Tests: 160 failed, 17 passed, 177 total
Simply changing the version of node to 14.17.0 gets the tests to work

Perhaps utilizing the engines clause in your package.json would help prevent future adventurers from falling in this same trap.
Especially since node 12.13.0 is a very common node version. It was easy enough for us to upgrade, we just didn't know this lib required the upgrade.
package.json
"engines": {
"node": ">=14.17.0"
},