1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-06 11:56:46 +01:00

Correctly show current backup asset date when createdAt is in the year of 1970

This commit is contained in:
Alex Tran 2023-01-22 22:40:56 -06:00
parent 171ba84741
commit 3aab8ccb4a
2 changed files with 12 additions and 9 deletions

View file

@ -274,7 +274,9 @@ class BackupService {
setCurrentUploadAssetCb( setCurrentUploadAssetCb(
CurrentUploadAsset( CurrentUploadAsset(
id: entity.id, id: entity.id,
createdAt: entity.createDateTime, createdAt: entity.createDateTime.year == 1970
? entity.modifiedDateTime
: entity.createDateTime,
fileName: originalFileName, fileName: originalFileName,
fileType: _getAssetType(entity.type), fileType: _getAssetType(entity.type),
), ),

View file

@ -468,6 +468,14 @@ class BackupControllerPage extends HookConsumerWidget {
} }
buildCurrentBackupAssetInfoCard() { buildCurrentBackupAssetInfoCard() {
String getAssetCreationDate() {
return DateFormat.yMMMMd('en_US').format(
DateTime.parse(
backupState.currentUploadAsset.createdAt.toString(),
).toLocal(),
);
}
return ListTile( return ListTile(
leading: Icon( leading: Icon(
Icons.info_outline_rounded, Icons.info_outline_rounded,
@ -576,14 +584,7 @@ class BackupControllerPage extends HookConsumerWidget {
fontSize: 10.0, fontSize: 10.0,
), ),
).tr( ).tr(
args: [ args: [getAssetCreationDate()],
DateFormat.yMMMMd('en_US').format(
DateTime.parse(
backupState.currentUploadAsset.createdAt
.toString(),
).toLocal(),
)
],
), ),
), ),
), ),