fix: timezone
parent
fbddac5c9c
commit
cf394811d2
|
|
@ -21,6 +21,6 @@ class Log {
|
|||
{this.id = 0, DateTime? date, this.uploaded = 0})
|
||||
: date = date ?? DateTime.now();
|
||||
|
||||
String get dateFormat => DateFormat('dd/MM/yyyy hh:mm:ss').format(date);
|
||||
String get dateEnFormat => DateFormat('yyyyMMdd hh:mm:ss').format(date);
|
||||
String get dateFormat => DateFormat('dd/MM/yyyy HH:mm:ss').format(date);
|
||||
String get dateEnFormat => DateFormat('yyyyMMdd HH:mm:ss').format(date);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class VisitPhoto {
|
|||
return image_name;
|
||||
}
|
||||
|
||||
String get dateFormat => DateFormat('dd.MM.yyyy hh:mm:ss').format(date_photo);
|
||||
String get dateFormat => DateFormat('dd.MM.yyyy HH:mm:ss').format(date_photo);
|
||||
|
||||
VisitPhoto copyWith({
|
||||
int? id,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,18 @@ late ObjectBox objectbox;
|
|||
|
||||
final EventBus eventBus = EventBus();
|
||||
|
||||
String getCurrentTimeZone(DateTime dateTime) {
|
||||
Duration offset = dateTime.timeZoneOffset;
|
||||
int offsetHours = offset.inHours;
|
||||
int offsetMinutes = offset.inMinutes.remainder(60);
|
||||
|
||||
String offsetSign = offset.isNegative ? '-' : '+';
|
||||
String timeZone =
|
||||
'$offsetSign${offsetHours.abs().toString().padLeft(2, '0')}:${offsetMinutes.abs().toString().padLeft(2, '0')}';
|
||||
|
||||
return timeZone;
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
// This is required so ObjectBox can get the application directory
|
||||
// to store the database in.
|
||||
|
|
@ -49,6 +61,9 @@ Future<void> main() async {
|
|||
/// initialize tracker plausible analytics
|
||||
await PlausibleUtil.initializePlausible(window.physicalSize.width);
|
||||
|
||||
// initialize time zone current device
|
||||
SharedPrefs().timeZone = getCurrentTimeZone(DateTime.now());
|
||||
|
||||
// url MP4
|
||||
SharedPrefs().urlMP4 =
|
||||
'https://mp4.ikksgroup.com/MobilePortal4/index.html#ajax/dashboard.html';
|
||||
|
|
|
|||
|
|
@ -175,4 +175,11 @@ class SharedPrefs {
|
|||
set photoSound(bool value) {
|
||||
_sharedPrefs.setBool('key_photo_sound', value);
|
||||
}
|
||||
|
||||
/// get/set user time zone
|
||||
String get timeZone => _sharedPrefs.getString('key_timeZone') ?? "";
|
||||
|
||||
set timeZone(String value) {
|
||||
_sharedPrefs.setString('key_timeZone', value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue