jalali_date 1.2.1
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 #
JalaliErawithsolarHijriandshahanshahi, and aneraparameter onformat,toString,PersianDate.parse, andPersianDate.tryParse: the year is written and read as Solar Hijri (1405) or Shahanshahi (2585). The storedyearstays Solar Hijri.shahanshahiYear:yearplus 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, andHijriDate.max.IranianHijri: the calendar behindHijriDate, moved fromjalali_holidays(nowiranian_holidays), withmonthStart,monthLength,date, andmonthStartsfor announced month starts.PersianDate.toHijri(),HijriDate.fromPersianDate,HijriDate.fromDateTime, andDateTime.toHijriDate().
1.1.0 #
Added #
- Date arithmetic:
addDays,addMonths,addYears(months and years clamp the day), anddifferenceInDays. - Comparisons:
isBefore,isAfter,isSameDay,isSameMonth,isSameYear,isToday, and the<,<=,>,>=operators. - Calendar anchors:
firstDayOfMonth,lastDayOfMonth,firstDayOfYear,lastDayOfYear,dayOfYear,daysInYear,quarter,season,seasonName, andseasonNames. - Persian week:
weekdayPersian(1 is Saturday),weekdayNameShort,weekdayNamesShort,isWeekend(Friday),startOfWeek,endOfWeek, andweekOfYear. - Parsing:
PersianDate.parseandPersianDate.tryParseforyyyy/MM/ddandyyyy-MM-ddstrings with an optional time and Persian or Arabic-Indic digits. - Persian digits:
toPersianDigits,toLatinDigits, and apersianDigitsflag ontoStringandformat. - Bounds and copies:
PersianDate.min,PersianDate.max, andcopyWith. - Time of day:
hasTime,hour,minute,second, andPersianDate.withTime. - JSON:
toJsonandPersianDate.fromJson. DateTime.toPersianDate()extension.formattokensE,D,Q,hh,h, anda, and single-quote escaping for literal text.- Latin names:
monthNameLatin,weekdayNameLatin,monthNamesLatin, andweekdayNamesLatin. - Dari month names used in Afghanistan:
monthNameDariandmonthNamesDari. daysUntilandPersianDateRangefor day sequences and range pickers.- README: Persian introduction, search keywords, a full quick reference, a date picker recipe, and notes for code generators.
Changed #
formattreats a single quote as the start of literal text, anda,E,D,Q,h, andhhare now tokens. Quote them to keep them literal.weekdayis computed from the day number instead of building aDateTime; 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
ldfield and the publicmonthsLengthandkabiseMonthsLengthtables are removed. year,month, anddayare final;greToJalis no longer public.toStringpads the date toyyyy/MM/ddand the time toHH:mm:ss.PersianDate(year, month, day)validates its arguments and throwsArgumentError.toStringthrowsArgumentErrorinstead of a genericExceptionwhen 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.isLeapYearandmonthLength.- Equality on
(year, month, day)andComparableordering. monthName,monthNames,weekday,weekdayName, andweekdayNames.showHour,showMinute, andshowSecondflags ontoString.format(pattern)for custom date strings.
0.0.1 July 10 2018 #
- Convert Gregorian date to Jalali date