You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using Object.freeze on moment instances and this has generally achieved what I have needed; except I just discovered that the following fails:
TypeError: Can't add property _isValid, object is not extensible
at valid__isValid (C:\git\quick-test\node_modules\moment\moment.js:93:24)
at Moment.moment_valid__isValid [as isValid] (C:\git\quick-test\node_modules\moment\moment.js:2195:16)
at Moment.isSame (C:\git\quick-test\node_modules\moment\moment.js:1945:44)
at Moment.isSameOrBefore (C:\git\quick-test\node_modules\moment\moment.js:1962:21)
Can this be fixed so that Object.freeze can be used when desired?
The text was updated successfully, but these errors were encountered:
const moment = require('moment')
const today = Object.freeze(moment());
today.toString()
=> 'Tue May 02 2017 10:04:52 GMT-0400'
today.add(1, 'day')
=> moment("2017-05-03T10:04:52.889")
today.toString()
=> 'Wed May 03 2017 10:04:52 GMT-0400'
Maybe I'm missing something but Object.freeze doesn't seem to work for me at all on latest release. I know that there's a large push for immutability in 3.x but in the meantime is there reliability in Object.freeze? /
Splitting out @kruncher's request from the discussion on #1754:
The text was updated successfully, but these errors were encountered: