You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dateToUnix now returns NaN for empty values instead of “now”.
Prevents false comparisons when no start/end exists yet.
isDateBetween now uses numeric timestamps explicitly.
Removes fragile object coercion behavior and keeps comparisons deterministic.
removeTime now normalizes from an existing parsed date and only applies timezone when needed.
Avoids double/ambiguous parsing.
days.tsx now checks startDate && endDate before “same-day range” comparison.
Prevents accidentally evaluating dayjs(undefined) and collapsing range styling.
onChange in range mode now converts already-normalized dates directly.
- So in short: it fixed because we made the range pipeline strictly compare real dates only, never “fallback now”, and avoid double parsing — which was especially visible in Jalali mode.
Thanks @sinabdollahi — I reviewed the changes carefully, and they all look good:
✅ dateToUnix → NaN — correctly fixes the silent "fallback to now" issue that caused the reset-on-first-tap symptom
✅ isDateBetween numeric comparison — safer and deterministic
✅ removeTime conditional .tz() — good defensive change
✅ days.tsx startDate/endDate guard — fixes a real range-highlight bug
✅ Range onChange simplification — verified Gregorian + timezone still emits correct dates
Merging. Thanks for the careful work and the clear description.
While testing, I found that calendar="jalali" + timeZone="Asia/Tehran" + mode="range" still crashes with RangeError: Invalid time value and emits dates with year 1405 AD. This bug exists on main too (pre-existing), so this PR doesn't introduce it.
Root cause: jalali-plugin-dayjs mutates global dayjs state and interacts badly with dayjs.tz() + .startOf('day').
I'll open a separate issue to track the Jalali + timezone fix. It likely requires a library-level change (replacing the plugin).
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
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.
This fixes #246
- So in short: it fixed because we made the range pipeline strictly compare real dates only, never “fallback now”, and avoid double parsing — which was especially visible in Jalali mode.