TF-2465 Fix wrong format date time
(cherry picked from commit b9a36007ef858025d0ec7c57aa7f9c5dfc61ea26)
This commit is contained in:
@@ -220,7 +220,7 @@ extension CalendarEventExtension on CalendarEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String formatDateTime(DateTime dateTime) {
|
String formatDateTime(date_format.DateLocale locale, DateTime dateTime) {
|
||||||
return date_format.formatDate(
|
return date_format.formatDate(
|
||||||
dateTime,
|
dateTime,
|
||||||
[
|
[
|
||||||
@@ -234,25 +234,25 @@ extension CalendarEventExtension on CalendarEvent {
|
|||||||
' ',
|
' ',
|
||||||
date_format.hh,
|
date_format.hh,
|
||||||
':',
|
':',
|
||||||
date_format.ss,
|
date_format.nn,
|
||||||
' ',
|
' ',
|
||||||
date_format.am
|
date_format.am
|
||||||
],
|
],
|
||||||
locale: AppUtils.getCurrentDateLocale()
|
locale: locale
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String formatTime(DateTime dateTime) {
|
String formatTime(date_format.DateLocale locale, DateTime dateTime) {
|
||||||
return date_format.formatDate(
|
return date_format.formatDate(
|
||||||
dateTime,
|
dateTime,
|
||||||
[
|
[
|
||||||
date_format.hh,
|
date_format.hh,
|
||||||
':',
|
':',
|
||||||
date_format.ss,
|
date_format.nn,
|
||||||
' ',
|
' ',
|
||||||
date_format.am
|
date_format.am
|
||||||
],
|
],
|
||||||
locale: AppUtils.getCurrentDateLocale()
|
locale: locale
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,15 +320,15 @@ extension CalendarEventExtension on CalendarEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (localStartDate != null && localEndDate != null) {
|
if (localStartDate != null && localEndDate != null) {
|
||||||
final timeStart = formatDateTime(localStartDate!);
|
final timeStart = formatDateTime(AppUtils.getCurrentDateLocale(), localStartDate!);
|
||||||
final timeEnd = DateUtils.isSameDay(localStartDate, localEndDate)
|
final timeEnd = DateUtils.isSameDay(localStartDate, localEndDate)
|
||||||
? formatTime(localEndDate!)
|
? formatTime(AppUtils.getCurrentDateLocale(), localEndDate!)
|
||||||
: formatDateTime(localEndDate!);
|
: formatDateTime(AppUtils.getCurrentDateLocale(), localEndDate!);
|
||||||
return '$timeStart - $timeEnd';
|
return '$timeStart - $timeEnd';
|
||||||
} else if (localStartDate != null) {
|
} else if (localStartDate != null) {
|
||||||
return formatDateTime(localStartDate!);
|
return formatDateTime(AppUtils.getCurrentDateLocale(), localStartDate!);
|
||||||
} else if (localEndDate != null) {
|
} else if (localEndDate != null) {
|
||||||
return formatDateTime(localEndDate!);
|
return formatDateTime(AppUtils.getCurrentDateLocale(), localEndDate!);
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user