calendar method

String calendar({
  1. DateTime? reference,
  2. bool omitHours = false,
  3. String? customFormat,
})

Returns calendar string in accordance with the reference, such as Yesterday, Last Sunday, or default date format concatenated with default hour format. Default formats are derived from the current localization.

reference is Moment.now() by default.

You can omit the hours using omitHours argument.

You can provide customFormat. Which will be used when the date is too far. e.g. when the moment is month away from referene, it'll use the customFormat

Using customFormat will make omitHours ineffective.

Implementation

String calendar({
  DateTime? reference,
  bool omitHours = false,
  String? customFormat,
}) =>
    localization.calendar(
      this,
      reference: reference,
      omitHours: omitHours,
      customFormat: customFormat,
    );