relativeTo method
- PersianDate other, {
- bool numeric = false,
- bool persianDigits = false,
This date relative to other in Persian, for example دیروز,
3 روز پیش, or ماه آینده.
When both dates have a time of day and are less than a day apart, the
result is in hours, minutes, or اکنون under a minute. Otherwise it
counts calendar days: days up to a week, then weeks while less than a
whole month has passed, then months and years as
differenceInMonths and differenceInYears count them.
The words follow CLDR, as Intl.RelativeTimeFormat('fa') writes them
in browsers. With numeric, a number is always written (1 روز پیش
instead of دیروز); with persianDigits, it is written as ۰ to ۹.
Implementation
String relativeTo(
PersianDate other, {
bool numeric = false,
bool persianDigits = false,
}) {
final text = _relativeTo(other, numeric);
return persianDigits ? toPersianDigits(text) : text;
}