Skip to content

fix: Handle invalid dates (e.g., Jalali calendar) by adding validation and fallback to updated date#1228

Open
Meshkati wants to merge 1 commit intoReadYouApp:mainfrom
Meshkati:fix/jalali-date-fallback
Open

fix: Handle invalid dates (e.g., Jalali calendar) by adding validation and fallback to updated date#1228
Meshkati wants to merge 1 commit intoReadYouApp:mainfrom
Meshkati:fix/jalali-date-fallback

Conversation

@Meshkati
Copy link

@Meshkati Meshkati commented Feb 4, 2026

Summary

  • Add date validation to reject dates with unreasonable years (before 1970)
  • Fall back to updatedDate when publishedDate is invalid
  • Fixes incorrect date display for feeds using non-Gregorian calendars (e.g., Persian/Jalali)

Problem

Some RSS/Atom feeds use Jalali (Persian) calendar dates with Persian numerals in the <published> tag:

<updated>2026-01-27T17:42:38Z</updated>
<published>۱۴۰۴-۱۱-۰۷T۱۱:۳۲:۰۶Z</published>

The Rome library converts Persian numerals (۰-۹) to ASCII (0-9) and parses 1404-11-07 as a valid Gregorian date. This results in articles displaying as "November 7, 1404" instead of the correct date (Jan 24, 2026).

Solution

Added isTooOld() validation that rejects dates before 1970 (Unix epoch). When publishedDate fails validation, we now fall back to updatedDate before using the current time.

Steps to Reproduce

  1. Add an RSS feed that uses Jalali dates (e.g., https://mrshabanali.com/feed/atom/)
  2. Observe that articles show dates like "November 7, 1404"
  3. With this fix, articles correctly show the date from tag
image

…d date

- Add isTooOld() validation to reject dates before 1970
- Fall back to updatedDate when publishedDate fails validation
- Fixes incorrect display of Jalali calendar dates
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.

1 participant