Skip to main content

jalali_date 1.2.1 copy "jalali_date: ^1.2.1" to clipboard
jalali_date: ^1.2.1 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.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
3
likes
160
points
118
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 #khorshidi #persian #calendar

License

Apache-2.0 (license)

More

Packages that depend on jalali_date