moment-timezone > 0.5.28 breaks Angular build

Bug #1884787 reported by Galen Charlton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
High
Unassigned
3.4
Fix Released
High
Unassigned

Bug Description

Starting with 0.5.29, moment-timezone now includes [0] an index.d.ts that adds Typescript type definitions. Unfortunately, this breaks how moment-timezone has been used to date. Here's an example of the ng build errors:

  ERROR in app/core/format.service.ts:164:62 - error TS2709: Cannot use namespace 'Moment' as a type.

  164 momentizeIsoString(isoString: string, timezone: string): Moment {
                                                                   ~~~~~~
  app/core/format.service.ts:171:76 - error TS2709: Cannot use namespace 'Moment' as a type.

  171 momentizeDateString(date: string, timezone: string, strict?, locale?): Moment {
                                                                                 ~~~~~~
  app/core/format.service.ts:178:80 - error TS2709: Cannot use namespace 'Moment' as a type.

  178 momentizeDateTimeString(date: string, timezone: string, strict?, locale?): Moment {
                                                                                     ~~~~~~
  app/core/format.service.ts:185:89 - error TS2709: Cannot use namespace 'Moment' as a type.

Pinning moment-timezone to its current value of 0.5.27 rather than ^0.5.27 avoids the error, although we should figure out how to properly import and use a Typescript-compatible moment-timezone.

[0] https://github.com/moment/moment-timezone/blob/develop/changelog.md

Evergreen master

Revision history for this message
Galen Charlton (gmc) wrote :

Setting importance to "high" because this is just an npm update away from being a constant build problem.

Revision history for this message
Galen Charlton (gmc) wrote :

Noting that pinning moment to 0.5.27 doesn't seem to require that moment be pinned to 2.24.

description: updated
Revision history for this message
Galen Charlton (gmc) wrote :
tags: added: angular pullrequest
Changed in evergreen:
milestone: none → 3.5.0
Changed in evergreen:
assignee: nobody → Jane Sandberg (sandbej)
Changed in evergreen:
assignee: Jane Sandberg (sandbej) → nobody
status: New → Confirmed
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Issue confirmed, and your fix works well, Galen. Sign-off branch at user/sandbergja/lp1884787_handle_new_moment-timezone. Thanks for spotting this before it caused trouble with the builds!

tags: added: signedoff
Bill Erickson (berick)
Changed in evergreen:
assignee: nobody → Bill Erickson (berick)
Revision history for this message
Bill Erickson (berick) wrote :

Hi, I have pushed another branch:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1884787-new-moment-timezone

* Includes additional sign-off's for existing commits.
* Adds a commit for some lint and test spec repairs.

For backporting, I'm assuming we don't want to backport changes to package.json and package-lock.json, since they will conflict with Angular 7 in 3.3 and 3.4.

Changed in evergreen:
assignee: Bill Erickson (berick) → nobody
Galen Charlton (gmc)
Changed in evergreen:
assignee: nobody → Galen Charlton (gmc)
Revision history for this message
Galen Charlton (gmc) wrote :

Pushed to master, rel_3_5, and backported to rel_3_4. Thanks, Bill and Jane!

Following discussion with Bill in #evergreen, the rel_3_4 backport simply pins moment-timezone to 0.5.27.

I removed the 3.3.x target as it turns out that moment-timezone is not included in that versions Angular app.

no longer affects: evergreen/3.3
Changed in evergreen:
assignee: Galen Charlton (gmc) → nobody
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.