metadata: fix display of mtime (fix #666)
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/672/head
parent
d7de507669
commit
7b027a1fe9
15
lib/Exif.php
15
lib/Exif.php
|
@ -202,14 +202,15 @@ class Exif
|
|||
}
|
||||
|
||||
// Fall back to modification time
|
||||
try {
|
||||
$parseTz = new \DateTimeZone(getenv('TZ')); // debian
|
||||
} catch (\Error $e) {
|
||||
$parseTz = new \DateTimeZone('UTC');
|
||||
}
|
||||
$dt = new \DateTime('@'.$file->getMtime());
|
||||
|
||||
$dt = new \DateTime('@'.$file->getMtime(), $parseTz);
|
||||
$dt->setTimezone($parseTz);
|
||||
// Set timezone to system timezone
|
||||
$tz = getenv('TZ') ?: date_default_timezone_get();
|
||||
try {
|
||||
$dt->setTimezone(new \DateTimeZone($tz));
|
||||
} catch (\Exception $e) {
|
||||
throw new \Error("FATAL: system timezone is invalid (TZ): $tz");
|
||||
}
|
||||
|
||||
return self::forgetTimezone($dt);
|
||||
}
|
||||
|
|
|
@ -179,8 +179,14 @@ export default defineComponent({
|
|||
|
||||
let dateWithTz: DateTime | undefined = undefined;
|
||||
|
||||
// If no timezone info is available, we will show the local time only
|
||||
// In this case, everything happens in UTC
|
||||
if (!tzOffset && !tzId) {
|
||||
dateWithTz = date.setZone('UTC');
|
||||
}
|
||||
|
||||
// Use timezone offset if available
|
||||
if (tzOffset) {
|
||||
if (!dateWithTz?.isValid && tzOffset) {
|
||||
dateWithTz = date.setZone('UTC' + tzOffset);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue