moment: Uncaught TypeError: Array.prototype.some called on null or undefined
getParsingFlags
is returning undefined parsedDatePart
property.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 3
- Comments: 21 (11 by maintainers)
Commits related to this issue
- see https://github.com/moment/moment/issues/3124 — committed to smnplk/react-bootstrap-daterangepicker by smnplk 8 years ago
- Force moment version. This should only be temporal until this issue is resolved: https://github.com/moment/moment/issues/3124 — committed to wizeline/bootstrap-daterangepicker by deleted user 8 years ago
To clarify for anybody who may be watching this thread, the issue occurs when a moment created with a pre 2.13 version is diffed with the 2.13 version. Pegging the datepickers to a pre-2.13 version will NOT solve the issue. Instead, you have 2 options:
Moving the datepickers to pre-2.13 will not solve the issue. Users on 2.13 will continue to get errors.
I wrote this code, so I’ll take the blame for it 😃. Can you tell me what the inputs are?
Just realized what I think this is - it’s the screenshot of the dependencies that did it.
Are you taking a Moment from the eonasdan datepicker and passing it into the diff function relative to a moment created using moment 2.13.0?
I think what is happening is that this is being bundled such that eonasdan-bootstrap-datetimepicker is giving you a moment object from v 2.8.4. That object is then copied using 2.13.0. 2.13.0 expects the property parsedDateParts to be on the _pf property - but because the moment was created with 2.8.4, it is in fact not. And there’s your error.
It takes a little setup to replicate this - but I think that might be what’s up.
Closing this. Moment objects can’t be expected to work across different versions of Moment. It’s just not something we can reasonably support.
@chengchengpei I just stepped through the chrome debugger until I saw the exception.
@maggiepint let me know if this helps you out