Skip to main content

jalali_date 1.3.4 copy "jalali_date: ^1.3.4" to clipboard
jalali_date: ^1.3.4 copied to clipboard

Persian (Jalali, Shamsi, Solar Hijri) and lunar Hijri calendars for Dart and Flutter: conversion, date arithmetic, parsing, formatting with Persian names and digits. Pure Dart.

1.3.4 #

Changed #

  • README: Flutter in the headline, links to the docs site and the Persian guide, a Support section.
  • pub.dev topics: flutter replaces khorshidi.

1.3.3 #

Changed #

  • README: a "Coming from shamsi_date" table maps its common calls to this package.

1.3.2 #

Changed #

  • Faster lunar Hijri dates after the official record: month starts predicted through Dhu al-Hijjah 1550 (past Jalali 1500) are stored, calculated in advance the same way, instead of being calculated on first use. The first HijriDate in 1460 takes 0.3 ms instead of 4.7 ms, and a Hijri year after 1448 no longer costs a crescent calculation per month. Months after 1550 are still calculated. Every month start is the same as before.
  • The first HijriDate no longer calculates four crescents to check the supported range: 0.2 ms instead of 16 ms.
  • parseFormat and tryParseFormat reuse the regular expression of a pattern: 8 µs instead of 141 µs per call for d MMMM yyyy.
  • Faster format, toPersianDigits, and toLatinDigits.
  • The VSOP87, nutation, and Moon tables are stored as flat number lists, so web builds that use nowruzMoment are about 1.9 KB smaller gzipped.

1.3.1 #

Changed #

  • README: the introduction, in English and Persian, lists the 1.3.0 features and says that holidays come from iranian_holidays, calculated offline or fetched online. "Building a date picker" points to jalali_calendar_picker, the notes for code generators cover the new APIs, and the API reference on nodets.com is linked.

1.3.0 #

Added #

  • PersianDate.nowruzMoment: the March equinox that begins a Jalali year (سال تحویل), in UTC, from VSOP87 with observed Delta T; within 4 seconds of every moment the University of Tehran announced from 2003 to 2026.
  • PersianDate.parseFormat and tryParseFormat: read text written with a format pattern, such as ۴ فروردین ۱۴۰۳ with d MMMM yyyy, including Persian, Latin, and Dari month names, weekday names, a and B for 12-hour times, Persian and Arabic-Indic digits, and Arabic letters.
  • dayPeriod and the B and BBBB format tokens: the part of the day in Persian (صبح, ظهر, عصر, شب) on CLDR's hours, so format('h B') gives 4 عصر.
  • toPersianWords: numbers in Persian words, هزار و چهارصد و سه, and ordinals with ordinal: true, بیست و چهارم.
  • format tokens dw (ordinal day in words) and yw (year in words, following era) on PersianDate and HijriDate: format('EEEE dw MMMM yw') gives چهارشنبه بیست و چهارم مرداد هزار و چهارصد و سه.
  • relativeTo and fromNow: relative time in Persian such as دیروز, 3 روز پیش, and ماه آینده, with the CLDR words that Intl.RelativeTimeFormat('fa') uses, numeric, and persianDigits.
  • differenceInMonths and differenceInYears: whole Jalali months and years between two dates, counted like addMonths, so date.addMonths(n).differenceInMonths(date) == n.

Fixed #

  • Hijri month starts from Muharram 1265 (1848) to Shawwal 1448 (Jalali 1405/12) follow Iran's official record, the calendars of the University of Tehran's Calendar Center from 1423 on and historical sources before that, as collected by the qamari project. 282 months start a day earlier or later than before, 17 of them since 1423, for example Jumada al-Ula 1448 now starts on 1405/07/20 as on the published calendar instead of 1405/07/21. HijriDate values in those months move by a day.
  • Where the crescent was seen on a different day than the calendar had predicted, the day it was seen counts: Ramadan 1432 starts on 1390/05/11.

Changed #

  • The README explains the leap-year rule and where other software differs, from 1502 on.
  • dw, yw, B, and BBBB are now format tokens. Quote them to keep them literal: format("'B'").

1.2.1 #

Changed #

  • The package description and the README introduction mention the lunar Hijri calendar and Shahanshahi years.

1.2.0 #

Added #

  • JalaliEra with solarHijri and shahanshahi, and an era parameter on format, toString, PersianDate.parse, and PersianDate.tryParse: the year is written and read as Solar Hijri (1405) or Shahanshahi (2585). The stored year stays Solar Hijri.
  • shahanshahiYear: year plus 1180.
  • HijriDate: the lunar Hijri date as Iran's official calendar counts it, with validation (ArgumentError), equality, ordering, monthName, monthLength, weekday, weekdayName, format, toPersianDate, toDateTime, HijriDate.min, and HijriDate.max.
  • IranianHijri: the calendar behind HijriDate, moved from jalali_holidays (now iranian_holidays), with monthStart, monthLength, date, and monthStarts for announced month starts.
  • PersianDate.toHijri(), HijriDate.fromPersianDate, HijriDate.fromDateTime, and DateTime.toHijriDate().

1.1.0 #

Added #

  • Date arithmetic: addDays, addMonths, addYears (months and years clamp the day), and differenceInDays.
  • Comparisons: isBefore, isAfter, isSameDay, isSameMonth, isSameYear, isToday, and the <, <=, >, >= operators.
  • Calendar anchors: firstDayOfMonth, lastDayOfMonth, firstDayOfYear, lastDayOfYear, dayOfYear, daysInYear, quarter, season, seasonName, and seasonNames.
  • Persian week: weekdayPersian (1 is Saturday), weekdayNameShort, weekdayNamesShort, isWeekend (Friday), startOfWeek, endOfWeek, and weekOfYear.
  • Parsing: PersianDate.parse and PersianDate.tryParse for yyyy/MM/dd and yyyy-MM-dd strings with an optional time and Persian or Arabic-Indic digits.
  • Persian digits: toPersianDigits, toLatinDigits, and a persianDigits flag on toString and format.
  • Bounds and copies: PersianDate.min, PersianDate.max, and copyWith.
  • Time of day: hasTime, hour, minute, second, and PersianDate.withTime.
  • JSON: toJson and PersianDate.fromJson.
  • DateTime.toPersianDate() extension.
  • format tokens E, D, Q, hh, h, and a, and single-quote escaping for literal text.
  • Latin names: monthNameLatin, weekdayNameLatin, monthNamesLatin, and weekdayNamesLatin.
  • Dari month names used in Afghanistan: monthNameDari and monthNamesDari.
  • daysUntil and PersianDateRange for day sequences and range pickers.
  • README: Persian introduction, search keywords, a full quick reference, a date picker recipe, and notes for code generators.

Changed #

  • format treats a single quote as the start of literal text, and a, E, D, Q, h, and hh are now tokens. Quote them to keep them literal.
  • weekday is computed from the day number instead of building a DateTime; the values are unchanged.
  • Homepage moved to https://nodets.com/jalali.

1.0.0 #

Breaking #

  • Requires Dart 3. The Flutter dependency is gone; the package is pure Dart.
  • The ld field and the public monthsLength and kabiseMonthsLength tables are removed.
  • year, month, and day are final; greToJal is no longer public.
  • toString pads the date to yyyy/MM/dd and the time to HH:mm:ss.
  • PersianDate(year, month, day) validates its arguments and throws ArgumentError.
  • toString throws ArgumentError instead of a generic Exception when nothing would be shown.

Fixed #

  • Gregorian to Jalali conversion is correct for Gregorian century years and across Jalali leap cycles (port of jalaali-js).

Added #

  • toDateTime() for Jalali to Gregorian conversion.
  • isLeapYear and monthLength.
  • Equality on (year, month, day) and Comparable ordering.
  • monthName, monthNames, weekday, weekdayName, and weekdayNames.
  • showHour, showMinute, and showSecond flags on toString.
  • format(pattern) for custom date strings.

0.0.1 July 10 2018 #

  • Convert Gregorian date to Jalali date
5
likes
160
points
1.02k
downloads

Documentation

API reference

Publisher

verified publishernodets.com

Weekly Downloads

Persian (Jalali, Shamsi, Solar Hijri) and lunar Hijri calendars for Dart and Flutter: conversion, date arithmetic, parsing, formatting with Persian names and digits. Pure Dart.

Homepage
Repository (GitHub)
View/report issues

Topics

#jalali #shamsi #flutter #persian #calendar

License

Apache-2.0 (license)

More

Packages that depend on jalali_date