INNER CODE UNIT · Dart

_cachedDateFormat

SimformSolutionsPvtLtd/chatview · lib/src/extensions/extensions.dart:82

  static DateFormat _cachedDateFormat(String pattern) =>
      _dateFormatCache['${Intl.getCurrentLocale()}|$pattern'] ??=
          DateFormat(pattern);

  String get getDateFromDateTime => _cachedDateFormat(dateFormat).format(this);

  String get getTimeFromDateTime => _cachedDateFormat('hh:mm a').format(this);

  /// Returns `true` if [other] occurs on the same calendar day as
  /// this [DateTime].
  ///
  /// This comparison checks only the year, month, and day components,
  /// and **ignores the time** (hour, minute, second, etc.).
  bool isSameCalendarDay(DateTime other) =>
      year == other.year && month == other.month && day == other.day;
}

/// Extension on String which implements different types string validations.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…