Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Moment.js to the Temporal API #321

Closed
wants to merge 11 commits into from
Closed

Conversation

mgwalker
Copy link
Member

@mgwalker mgwalker commented Aug 11, 2021

Longterm WIP

The Temporal API is currently a TC39 stage 3 proposal, which means the API is nearly completed and is not expected to change much more before final approval. It will be a while yet before it has native implementations, but there's no reason we can't start playing with it now using the polyfill.

The goal of this WIP PR is to explore migrating every current use of Moment.js in Charlie to the Temporal API. Some of those may be harder than others, and may justify switching to a different library instead of using the Temporal API directly. Since there's no rush to make this change, a long-running PR seemed like a reasonable approach to figuring out what we should do.

The following parts of the bot rely on Moment.js and should be migrated:

  • angry Tock
  • encourage bot
  • federal holidays reminder
  • federal holidays
  • optimistic Tock
  • timezone ("Tau bot")
  • travel team bot
  • what-day-is-it (March 2020 bot)
  • utils/dates

This PR is a step towards addressing #295.

src/utils/dates.js Outdated Show resolved Hide resolved
src/scripts/angry-tock.js Outdated Show resolved Hide resolved
src/scripts/angry-tock.js Outdated Show resolved Hide resolved
src/scripts/timezone.js Outdated Show resolved Hide resolved
*/
const m = () => moment.tz(ANGRY_TOCK_TIMEZONE);
const m = () =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename this to t or even something verbose like currentZonedDateTime()?

Suggested change
const m = () =>
const currenetZonedDateTime = () =>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I put this on my mental checklist of things to come back and do and then forgot. But your comment also reminded me that I'd made this functionality available from the dates utility module, so I switched to using that. 😄

src/scripts/angry-tock.js Outdated Show resolved Hide resolved
@mgwalker
Copy link
Member Author

Closing as ancient.

@mgwalker mgwalker closed this Sep 23, 2022
@mgwalker mgwalker deleted the mgwalker/temporal branch April 12, 2023 16:11
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.

2 participants