formatRangeStartDate function

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

Format the start date of a range. localizations is the MaterialLocalizations object to use for the formatting. startDate is the start date of the range. endDate is the end date of the range. Returns the formatted start date.

Implementation

String formatRangeStartDate(MaterialLocalizations localizations,
    NepaliDateTime? startDate, NepaliDateTime? endDate) {
  return startDate == null
      ? localizations.dateRangeStartLabel
      : (endDate == null || startDate.year == endDate.year)
          ? NepaliDateFormat('MMMM d').format(startDate)
          : NepaliDateFormat.yMd().format(startDate);
}