From b9a36007ef858025d0ec7c57aa7f9c5dfc61ea26 Mon Sep 17 00:00:00 2001 From: hieubt Date: Thu, 18 Jan 2024 17:57:12 +0700 Subject: [PATCH] TF-2465 Fix wrong format date time --- .../extensions/calendar_event_extension.dart | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/features/email/presentation/extensions/calendar_event_extension.dart b/lib/features/email/presentation/extensions/calendar_event_extension.dart index ae4d8fad44..67a8c87c67 100644 --- a/lib/features/email/presentation/extensions/calendar_event_extension.dart +++ b/lib/features/email/presentation/extensions/calendar_event_extension.dart @@ -220,7 +220,7 @@ extension CalendarEventExtension on CalendarEvent { } } - String formatDateTime(DateTime dateTime) { + String formatDateTime(date_format.DateLocale locale, DateTime dateTime) { return date_format.formatDate( dateTime, [ @@ -234,39 +234,39 @@ extension CalendarEventExtension on CalendarEvent { ' ', date_format.hh, ':', - date_format.ss, + date_format.nn, ' ', date_format.am ], - locale: AppUtils.getCurrentDateLocale() + locale: locale ); } - String formatTime(DateTime dateTime) { + String formatTime(date_format.DateLocale locale, DateTime dateTime) { return date_format.formatDate( dateTime, [ date_format.hh, ':', - date_format.ss, + date_format.nn, ' ', date_format.am ], - locale: AppUtils.getCurrentDateLocale() + locale: locale ); } String get dateTimeEventAsString { if (localStartDate != null && localEndDate != null) { - final timeStart = formatDateTime(localStartDate!); + final timeStart = formatDateTime(AppUtils.getCurrentDateLocale(), localStartDate!); final timeEnd = DateUtils.isSameDay(localStartDate, localEndDate) - ? formatTime(localEndDate!) - : formatDateTime(localEndDate!); + ? formatTime(AppUtils.getCurrentDateLocale(), localEndDate!) + : formatDateTime(AppUtils.getCurrentDateLocale(), localEndDate!); return '$timeStart - $timeEnd'; } else if (localStartDate != null) { - return formatDateTime(localStartDate!); + return formatDateTime(AppUtils.getCurrentDateLocale(), localStartDate!); } else if (localEndDate != null) { - return formatDateTime(localEndDate!); + return formatDateTime(AppUtils.getCurrentDateLocale(), localEndDate!); } else { return ''; }