@ -835,7 +835,11 @@ export class MetadataService extends BaseService {
}
}
private getDates ( asset : { id : string ; originalPath : string } , exifTags : ImmichTags , stats : Stats ) {
private getDates (
asset : { id : string ; originalPath : string ; fileCreatedAt : Date } ,
exifTags : ImmichTags ,
stats : Stats ,
) {
const result = firstDateTime ( exifTags ) ;
const tag = result ? . tag ;
const dateTime = result ? . dateTime ;
@ -864,7 +868,12 @@ export class MetadataService extends BaseService {
if ( ! localDateTime || ! dateTimeOriginal ) {
// FileCreateDate is not available on linux, likely because exiftool hasn't integrated the statx syscall yet
// birthtime is not available in Docker on macOS, so it appears as 0
const earliestDate = stats . birthtimeMs ? new Date ( Math . min ( stats . mtimeMs , stats . birthtimeMs ) ) : stats . mtime ;
const earliestDate = new Date (
Math . min (
asset . fileCreatedAt . getTime ( ) ,
stats . birthtimeMs ? Math . min ( stats . mtimeMs , stats . birthtimeMs ) : stats . mtime . getTime ( ) ,
) ,
) ;
this . logger . debug (
` No exif date time found, falling back on ${ earliestDate . toISOString ( ) } , earliest of file creation and modification for asset ${ asset . id } : ${ asset . originalPath } ` ,
) ;