fix(#11241): ensure Bikram Sambat date conversion uses local date string format#11251
Open
binokaryg wants to merge 2 commits into
Open
fix(#11241): ensure Bikram Sambat date conversion uses local date string format#11251binokaryg wants to merge 2 commits into
binokaryg wants to merge 2 commits into
Conversation
…e string format Pass a local YYYY-MM-DD string to bikram-sambat instead of a moment, so an evening time-of-day no longer rolls the date over before local midnight in timezones ahead of UTC (Nepal, from 18:15). Force the 'en' locale on a clone so the active 'ne' locale doesn't emit Devanagari numerals that Date.parse can't read. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
binokaryg
marked this pull request as draft
July 14, 2026 21:01
Member
Author
binokaryg
marked this pull request as ready for review
July 15, 2026 01:07
sugat009
self-requested a review
July 21, 2026 08:40
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
When the webapp is used in Nepali (Bikram Sambat calendar), the displayed date rolled over to the next day several hours before local midnight. In Nepal (UTC+5:45) it changed at 18:15 (6:15 PM) instead of midnight.
Root cause:
FormatDateServicepassed amomentobject tobikram-sambat, whosetoBik_text/toBikexpect an ISO date string (YYYY-MM-DD). The library'sDate.parsethen consumed the full timestamp, so an evening time-of-day rolled the day over early in timezones ahead of UTC. Additionally, with thenelocale active,moment.formatemits Devanagari numerals, whichDate.parsecannot read, causing the "Date outside supported range" crash.Fix: format the moment to a local
YYYY-MM-DDstring before passing it to the library, and force theenlocale on a clone so the numerals stay ASCII (thedatetimetime-portion remains localised). This pins the conversion to the local calendar day so the date changes at local midnight.Tests: updated the existing
date/datetime/dayMonthspecs to assert the library now receives the local date string, and added two regression tests informat-date.service.spec.tsBoth new tests were verified to fail on the unfixed code and pass with the fix.
Fixes: #11241
AI disclosure
Per the AI contribution guidelines:
momenttobikram-sambatinstead of an ISO date string, plus thene-locale Devanagari-numeral crash), implementing the fix, and writing the unit tests and code comments.All changes were reviewed and tested by me; the new tests were verified to fail without the fix and pass with it.
Code review checklist
can_view_old_navigationpermission to see the old design. Test it has appropriate design for RTL languages.License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.