Repository navigation
fix(#7018): format task dates with latin digits in every locale - #11506
Draft
Gillinghammer wants to merge 1 commit into
Draft
Gillinghammer wants to merge 1 commit into
Gillinghammer wants to merge 1 commit into
Conversation
Task window dates were formatted with the global moment locale, so users on ne/hi or ar saved dueDate, startDate and endDate with Devanagari or Arabic-Indic digits. Format them in the 'en' locale instead, and convert the digits of windows already saved on task docs so they still compare correctly against today's date. Assisted-by: Claude Code (claude-opus-5-5)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Task docs created by users whose language is Nepali or Hindi (or Arabic) were saved with
dueDate,startDateandendDatein Devanagari (or Arabic-Indic) digits, e.g.२०२१-०३-१७. The webapp sets the global moment locale to the user's language, andtask-states.jsformatted those dates without pinning a locale.provider-wireup.jsalready uses.locale('en')for the same reason.As well as breaking analytics, this also affected task states: a window saved in Latin digits was compared against a Devanagari "today", so a current task could come out as
Failed.Changes, all in
shared-libs/rules-engine/src/task-states.js:calculateStateare now always formatted in theenlocale.How I tested it:
moment.locale(['ne', 'en'])the window came out as२०२१-०३-१७, and a window saved in Latin digits came outFailedinstead ofReady. Both are correct after the change.shared-libs/rules-engine/test/task-states.spec.jsfor theneandarlocales and for windows saved with localized digits. The 6 new tests fail on master and pass with the fix.cd shared-libs/rules-engine && TZ=<tz> npm testwithCanada/Pacific,Africa/MonroviaandPacific/Auckland: 230 passing in each, no failures.npx eslinton the two changed files: clean. I didn't run the webapp Karma suite locally.Fixes #7018
Code review checklist
AI Disclosure: Prepared with Claude Code via TOA, reviewed by @Gillinghammer. Claude Code (claude-opus-5-5) wrote the code and tests and a separate AI review pass checked them.
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.