Skip to content

refactor(runners): replace Moment.js with Day.js - #5606

Open
junland wants to merge 1 commit into
github-aws-runners:mainfrom
junland:momentjs-migration
Open

junland wants to merge 1 commit into
github-aws-runners:mainfrom
junland:momentjs-migration

Conversation

@junland

@junland junland commented Nov 26, 2026 •

Copy link
Copy Markdown

This pull request replaces the moment and moment-timezone libraries which are in maintenance mode with dayjs (and relevant plugins) throughout the control plane and EC2 runner code. This change modernizes date/time handling, reduces bundle size, and improves maintainability. All usages of moment for date manipulation, timezone, and UTC handling have been refactored to use dayjs, and the necessary plugins (utc, timezone) are now initialized where needed.

Note: This PR and its associated code was assisted with GitHub Copilot using the GPT-6 Luna model.

Dependency updates and replacements:

  • Removed moment and moment-timezone from dependencies in package.json files and added dayjs (plus plugins) as a replacement. [1] [2] [3]

Refactoring date/time logic:

  • Updated all imports and usages of moment to use dayjs (with utc and timezone plugins) in the following files: scale-down-config.ts, scale-down-config.test.ts, scale-down.ts, scale-down.test.ts, and runners.ts. This includes logic for current time, time zone conversions, and date arithmetic. [1] [2] [3] [4] [5]
  • Replaced all instances of moment(...).add(...), moment(...).subtract(...), and moment(...).diff(...) with equivalent dayjs operations. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Initialization of plugins:

  • Ensured dayjs.extend(utc) and dayjs.extend(timezone) are called at the top of relevant files to enable UTC and timezone support. [1] [2] [3] [4] [5]## Description

Test Plan

  • Successfully ran unit tests for both scale-down and scale-down-config.
  • Additionally ran all 11 unit tests with all of them succeeding.

Related Issues

Closes #3435

@junland
junland marked this pull request as ready for review November 26, 2026 15:53
@junland
junland requested a review from a team as a code owner November 26, 2026 15:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Momentjs is in maintenace mode

1 participant