formatRangeStartDate function

String formatRangeStartDate(
  1. MaterialLocalizations localizations,
  2. Jalali? startDate,
  3. Jalali? endDate
)

Returns a locale-appropriate string to describe the start of a date range.

If startDate is null, then it defaults to 'Start Date', otherwise if it is in the same year as the endDate then it will use the short month day format (i.e. 'Jan 21'). Otherwise it will return the short date format (i.e. 'Jan 21, 2020').

Implementation

String formatRangeStartDate(
    MaterialLocalizations localizations, Jalali? startDate, Jalali? endDate) {
  return startDate == null
      ? 'تاریخ شروع'
      : (endDate == null || startDate.year == endDate.year)
          ? startDate.formatShortMonthDay()
          : startDate.formatShortDate();
}