mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
0aee6e1b8d
* create standart list card item * create standart list status item * update localization * fix date format * fix theme gradient * PR comments * fix issues from code review
23 lines
957 B
Dart
23 lines
957 B
Dart
import 'package:intl/intl.dart';
|
|
import 'package:cake_wallet/di.dart';
|
|
import 'package:cake_wallet/store/settings_store.dart';
|
|
|
|
class DateFormatter {
|
|
static String currentLocalFormat({bool hasTime = true, bool reverse = false}) {
|
|
final isUSA = getIt.get<SettingsStore>().languageCode.toLowerCase() == 'en';
|
|
final format =
|
|
isUSA ? usaStyleFormat(hasTime, reverse) : regularStyleFormat(hasTime, reverse);
|
|
|
|
return format;
|
|
}
|
|
|
|
static DateFormat withCurrentLocal({bool hasTime = true, bool reverse = false}) => DateFormat(
|
|
currentLocalFormat(hasTime: hasTime, reverse: reverse),
|
|
getIt.get<SettingsStore>().languageCode);
|
|
|
|
static String usaStyleFormat(bool hasTime, bool reverse) =>
|
|
hasTime ? (reverse ? 'HH:mm yyyy.MM.dd' : 'yyyy.MM.dd, HH:mm') : 'yyyy.MM.dd';
|
|
|
|
static String regularStyleFormat(bool hasTime, bool reverse) =>
|
|
hasTime ? (reverse ? 'HH:mm dd.MM.yyyy' : 'dd.MM.yyyy, HH:mm') : 'dd.MM.yyyy';
|
|
}
|