1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Merge pull request #480 from mcdamo/bug/date-timezone

Use UTC for displaying image timestamps
This commit is contained in:
Patrik J. Braun 2022-05-01 20:59:30 +02:00 committed by GitHub
commit 55558a07ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

@ -28,10 +28,10 @@
</div>
<div class="col-10">
<div class="details-main">
{{ media.metadata.creationDate | date: (isThisYear() ? 'MMMM d' : 'longDate')}}
{{ media.metadata.creationDate | date: (isThisYear() ? 'MMMM d' : 'longDate') : 'UTC' }}
</div>
<div class="details-sub row">
<div class="col-12">{{ media.metadata.creationDate | date :'EEEE'}}, {{getTime()}}</div>
<div class="col-12">{{ media.metadata.creationDate | date : 'EEEE, HH:mm:ss' : 'UTC' }}</div>
</div>
</div>
</div>

View File

@ -150,15 +150,10 @@ export class InfoPanelLightboxComponent implements OnInit, OnChanges {
isThisYear(): boolean {
return (
new Date().getFullYear() ===
new Date(this.media.metadata.creationDate).getFullYear()
new Date(this.media.metadata.creationDate).getUTCFullYear()
);
}
getTime(): string {
const date = new Date(this.media.metadata.creationDate);
return date.toTimeString().split(' ')[0];
}
toFraction(f: number): string | number {
if (f > 1) {
return f;