Skip to content

Commit

Permalink
TF-2465 Fix wrong format date time
Browse files Browse the repository at this point in the history
  • Loading branch information
hieutbui authored and hoangdat committed Jan 18, 2024
1 parent c0586e7 commit b9a3600
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
[
Expand All @@ -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 '';
}
Expand Down

0 comments on commit b9a3600

Please sign in to comment.