Date formating issue #527
This commit is contained in:
parent
8b5a75008b
commit
241897dbc0
|
|
@ -421,6 +421,7 @@ String formatDate(String value, BuildContext context,
|
|||
|
||||
final state = StoreProvider.of<AppState>(context).state;
|
||||
final CompanyEntity company = state.company;
|
||||
var formattedValue = '';
|
||||
|
||||
if (showTime) {
|
||||
String format;
|
||||
|
|
@ -450,15 +451,18 @@ String formatDate(String value, BuildContext context,
|
|||
final formatter = DateFormat(format, localeSelector(state));
|
||||
final parsed = DateTime.tryParse(value.endsWith('Z') ? value : value + 'Z');
|
||||
|
||||
return parsed == null ? '' : formatter.format(parsed.toLocal());
|
||||
formattedValue = parsed == null ? '' : formatter.format(parsed.toLocal());
|
||||
} else {
|
||||
final dateFormats = state.staticState.dateFormatMap;
|
||||
final formatter = DateFormat(
|
||||
dateFormats[company.settings.dateFormatId].format,
|
||||
localeSelector(state));
|
||||
final parsed = DateTime.tryParse(value);
|
||||
return parsed == null ? '' : formatter.format(parsed);
|
||||
formattedValue = parsed == null ? '' : formatter.format(parsed);
|
||||
}
|
||||
|
||||
// Fix double periods in dates in foreign languages #527
|
||||
return formattedValue.replaceFirst('..', '.');
|
||||
}
|
||||
|
||||
String formatApiUrl(String url) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue