jsmreese / moment-duration-format

Format function plugin for the Moment Duration object.
MIT License
969 stars 120 forks source link

ReferenceError: window is not defined in v2.3.0 #131

Closed pdcastro closed 5 years ago

pdcastro commented 5 years ago

My Node.js CI build started failing with the following error, apparently as a result of an update from v2.2.2 to v2.3.0:

node_modules\moment-duration-format\lib\moment-duration-format.js:1723
        if (window.Intl && window.Intl.NumberFormat) {
        ^
ReferenceError: window is not defined

Perhaps a regression of #81 (ReferenceError: window is not defined (2.0.0))?

Probably connected to PR #122, merged a few hours ago.

Workaround: pinning to version ~2.2.2.

jsmreese commented 5 years ago

Thanks, and sorry for neglecting to run the tests on node. Really should have automated that!

Page- commented 5 years ago

I think this is still an issue because window doesn't exist at all so the safe check is typeof window !== 'undefined' && ...