mirror of
https://github.com/immich-app/immich.git
synced 2025-12-05 20:40:29 -08:00
* fixed the timezone issue in the Immich mobile app's metadata sheet to match the web app's behavior * format dart * now uses the shared applyTimezoneOffset() utility function from mobile/lib/utils/timezone.dart * add tests --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
18 lines
659 B
Dart
18 lines
659 B
Dart
import 'package:immich_mobile/entities/asset.entity.dart';
|
|
import 'package:immich_mobile/utils/timezone.dart';
|
|
|
|
extension TZExtension on Asset {
|
|
/// Returns the created time of the asset from the exif info (if available) or from
|
|
/// the fileCreatedAt field, adjusted to the timezone value from the exif info along with
|
|
/// the timezone offset in [Duration]
|
|
(DateTime, Duration) getTZAdjustedTimeAndOffset() {
|
|
DateTime dt = fileCreatedAt.toLocal();
|
|
|
|
if (exifInfo?.dateTimeOriginal != null) {
|
|
return applyTimezoneOffset(dateTime: exifInfo!.dateTimeOriginal!, timeZone: exifInfo?.timeZone);
|
|
}
|
|
|
|
return (dt, dt.timeZoneOffset);
|
|
}
|
|
}
|