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 deprecation warning of unformatted moment call #1767

Merged
merged 1 commit into from
Aug 29, 2019

Conversation

noratarano
Copy link
Contributor

@noratarano noratarano commented Aug 26, 2019

Summary

Removes this very distracting warning.

$ npm run mocha

> react-dates@20.3.0 mocha /Users/nora_tarano/airlab-shared/repos/react-dates
> mocha ./test/_helpers

Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments: 
[0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: 10/10/2017, _f: undefined, _strict: undefined, _locale: [object Object]
Error: 
    at Function.createFromInputFallback (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/moment/moment.js:320:98)
    at configFromString (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/moment/moment.js:2385:15)
    at configFromInput (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/moment/moment.js:2611:13)
    at prepareConfig (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/moment/moment.js:2594:13)
    at createFromConfig (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/moment/moment.js:2561:44)
    at createLocalOrUTC (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/moment/moment.js:2648:16)
    at createLocal (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/moment/moment.js:2652:16)
    at hooks (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/moment/moment.js:12:29)
    at Object.<anonymous> (/Users/nora_tarano/airlab-shared/repos/react-dates/test/utils/getCalendarDaySettings_spec.js:8:17)
    at Module._compile (module.js:635:30)
    at Module._compile (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (module.js:646:10)
    at Object.newLoader [as .js] (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/pirates/lib/index.js:104:7)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at /Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/mocha/lib/mocha.js:514:10)
    at Object.<anonymous> (/Users/nora_tarano/airlab-shared/repos/react-dates/node_modules/mocha/bin/_mocha:480:18)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

Reviewers

@ljharb @majapw @TaeKimJR @ahuth @indiesquidge

@noratarano noratarano added the semver-patch: fixes/refactors/etc Anything that's not major or minor. label Aug 26, 2019
@noratarano
Copy link
Contributor Author

@ljharb What label do we set for this change? I can't find a semver-exempt. What's the equivalent for this repo?

@coveralls
Copy link

coveralls commented Aug 26, 2019

Coverage Status

Coverage remained the same at 84.895% when pulling 760a72a on nora--fix-moment-test into b46cedf on master.

@noratarano
Copy link
Contributor Author

noratarano commented Aug 27, 2019

@ljharb Also, any way I can bypass the coverage/coveralls check? I'm not making any changes to the code and don't expect to have update coverage 🤔 Is this new? Did something break with the coverage?

@ljharb
Copy link
Member

ljharb commented Aug 27, 2019

You can just merge through that. For exempt, just don’t apply a semver label :-)

@@ -5,7 +5,7 @@ import sinon from 'sinon-sandbox';
import getCalendarDaySettings from '../../src/utils/getCalendarDaySettings';
import { BLOCKED_MODIFIER } from '../../src/constants';

const testDay = moment('10/10/2017');
const testDay = moment('10/10/2017', 'MM/DD/YYYY');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw i think this works too:

Suggested change
const testDay = moment('10/10/2017', 'MM/DD/YYYY');
const testDay = moment('10-10-2017');

@ljharb ljharb removed the semver-patch: fixes/refactors/etc Anything that's not major or minor. label Aug 27, 2019
@noratarano noratarano closed this Aug 29, 2019
@noratarano noratarano reopened this Aug 29, 2019
@noratarano noratarano merged commit cc1e339 into master Aug 29, 2019
@noratarano noratarano deleted the nora--fix-moment-test branch August 29, 2019 06:53
@noratarano noratarano mentioned this pull request Sep 10, 2019
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

Successfully merging this pull request may close these issues.

None yet

3 participants