Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#50408 closed defect (bug) (fixed)

Update moment.js lib to its latest version

Reported by: yoancutillas's profile yoancutillas Owned by: desrosj's profile desrosj
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.4.2
Component: External Libraries Keywords: has-dev-note
Focuses: Cc:



The core-bundled momentjs library hasn't been updated in two years (2.22.2 - Jun 1, 2018).

JQMigrate displays a deprecation warning:

Deprecation warning: use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See for more info.

And some plugins and themes encounter javascript fatal errors (blocking) because of it:

Is it possible to update momentjs to its latest version (currently 2.26.0 - May 20, 2020)?


Change History (6)

#1 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 5.5

#2 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 48075:

External Libraries: Update Moment.js to 2.26.0.


This commit also fixes a deprecation warning regarding the usage of moment.locale() to set locale properties.

As of Moment.js 2.12.0, moment.locale() is deprecated and moment.updateLocale() should be used instead.

Additionally, minimize moment.js as part of build process to remove the source map reference.

This avoids a sourceMappingURL being in the minified file, as we don't ship source maps.

Props yoancutillas, SergeyBiryukov.
Fixes #50408.

#4 @Hareesh Pillai
3 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

There was a new version (v2.27.0) of moment.js released two weeks ago. Let us try to update to this version before the beta.

#5 @desrosj
3 years ago

  • Owner changed from SergeyBiryukov to desrosj
  • Status changed from reopened to assigned

Thanks @hareesh-pillai!

#6 @desrosj
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 48269:

External Libraries: Update Moment.js to version 2.27.0.

A full list of changes in this update can be found on GitHub:

Props hareesh-pillai, desrosj.
Previously [48075].
Fixes #50408.

Note: See TracTickets for help on using tickets.