mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -07:00
Merge pull request #4320 from bernarden/feature/all-short-dates-should-be-formatted-according-to-user-browser-preferences
Updates short date formatting to use user's browser preference.
This commit is contained in:
commit
d15ddb6e16
13 changed files with 29 additions and 16 deletions
|
@ -63,7 +63,7 @@
|
|||
|
||||
<div class="messages msg_sent"> <i *ngIf="isAdmin" style="float:right;" class="fas fa-times" aria-hidden="true" (click)="deleteComment(comment.id)"></i>
|
||||
<p>{{comment.comment}}</p>
|
||||
<time>{{comment.username}} • {{comment.date | amLocal | amDateFormat: 'l LT'}}</time>
|
||||
<time>{{comment.username}} • {{comment.date | amFromUtc | amLocal | amUserLocale | amDateFormat: 'l LT'}}</time>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
<ng-container matColumnDef="airDate">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'Requests.AirDate' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.airDate | amLocal | amDateFormat: 'L' }}</td>
|
||||
<td mat-cell *matCellDef="let element"> {{element.airDate | amLocal | amUserLocale | amDateFormat: 'L' }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="status">
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
<ng-container matColumnDef="airDate">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'Requests.AirDate' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.airDate | amLocal | amDateFormat: 'L' }}</td>
|
||||
<td mat-cell *matCellDef="let element"> {{element.airDate | amLocal | amUserLocale | amDateFormat: 'L' }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="status">
|
||||
|
|
12
src/Ombi/ClientApp/src/app/pipes/UserLocalePipe.ts
Normal file
12
src/Ombi/ClientApp/src/app/pipes/UserLocalePipe.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { Pipe, PipeTransform } from "@angular/core";
|
||||
import * as moment from "moment";
|
||||
|
||||
const momentConstructor = moment;
|
||||
|
||||
@Pipe({ name: "amUserLocale" })
|
||||
export class UserLocalePipe implements PipeTransform {
|
||||
transform(value: moment.MomentInput): moment.Moment {
|
||||
const locale = navigator.language;
|
||||
return momentConstructor(value).locale(locale);
|
||||
}
|
||||
}
|
|
@ -3,11 +3,12 @@ import { HumanizePipe } from "./HumanizePipe";
|
|||
import { ThousandShortPipe } from "./ThousandShortPipe";
|
||||
import { SafePipe } from "./SafePipe";
|
||||
import { QualityPipe } from "./QualityPipe";
|
||||
import { UserLocalePipe } from "./UserLocalePipe";
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
declarations: [HumanizePipe, ThousandShortPipe, SafePipe, QualityPipe],
|
||||
exports: [HumanizePipe, ThousandShortPipe, SafePipe, QualityPipe],
|
||||
declarations: [HumanizePipe, ThousandShortPipe, SafePipe, QualityPipe, UserLocalePipe],
|
||||
exports: [HumanizePipe, ThousandShortPipe, SafePipe, QualityPipe, UserLocalePipe],
|
||||
})
|
||||
export class PipeModule {
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
{{ep.title}}
|
||||
</td>
|
||||
<td>
|
||||
{{ep.airDate | amLocal | amDateFormat: 'L' }}
|
||||
{{ep.airDate | amLocal | amUserLocale | amDateFormat: 'L' }}
|
||||
</td>
|
||||
<td>
|
||||
<span *ngIf="child.denied" class="label label-danger" id="deniedLabel"
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
<h4>{{result.title}} ({{result.releaseDate | amLocal | amDateFormat: 'YYYY'}})</h4>
|
||||
</a>
|
||||
|
||||
<span *ngIf="result.releaseDate" class="label label-info" target="_blank">Release Date: {{result.releaseDate | amLocal | amDateFormat: 'L'}}</span>
|
||||
<span *ngIf="result.releaseDate" class="label label-info" target="_blank">Release Date: {{result.releaseDate | amLocal | amUserLocale | amDateFormat: 'L'}}</span>
|
||||
|
||||
<a *ngIf="result.homepage" href="{{result.homepage}}" id="homepageLabel" target="_blank">
|
||||
<span class="label label-info">HomePage</span>
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
|
||||
<ng-template [ngIf]="result.releaseDate">
|
||||
<span class="label label-info" id="availableLabel">Release Date: {{result.releaseDate | amLocal | amDateFormat: 'L'}}</span>
|
||||
<span class="label label-info" id="availableLabel">Release Date: {{result.releaseDate | amLocal | amUserLocale | amDateFormat: 'L'}}</span>
|
||||
</ng-template>
|
||||
<ng-template [ngIf]="result.rating">
|
||||
<span class="label label-info" id="availableLabel">{{result.rating}}/10</span>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
{{ep.title}}
|
||||
</td>
|
||||
<td *ngIf="ep.airDateDisplay != 'Unknown'">
|
||||
{{ep.airDate | amLocal | amDateFormat: 'L' }}
|
||||
{{ep.airDate | amLocal | amUserLocale | amDateFormat: 'L' }}
|
||||
</td>
|
||||
<td *ngIf="ep.airDateDisplay == 'Unknown'">
|
||||
{{ep.airDateDisplay }}
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
<span *ngIf="node.status" class="label label-primary" id="statusLabel" target="_blank">{{node.status}}</span>
|
||||
|
||||
|
||||
<span *ngIf="node.firstAired" class="label label-info" target="_blank" id="airDateLabel">{{ 'Search.TvShows.AirDate' | translate }} {{node.firstAired | amLocal | amDateFormat: 'L'}}</span>
|
||||
<span *ngIf="node.firstAired" class="label label-info" target="_blank" id="airDateLabel">{{ 'Search.TvShows.AirDate' | translate }} {{node.firstAired | amLocal | amUserLocale | amDateFormat: 'L'}}</span>
|
||||
|
||||
<span *ngIf="node.network" class="label label-info" id="networkLabel" target="_blank">{{node.network}}</span>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<p class="name" *ngIf="m?.username">{{m.username}}</p>
|
||||
<br/>
|
||||
<p class="message">{{m.message}}</p>
|
||||
<p class="timestamp">{{m.date | amLocal | amDateFormat: 'l LT'}}</p>
|
||||
<p class="timestamp">{{m.date | amFromUtc | amLocal | amUserLocale | amDateFormat: 'l LT'}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
{{ep.title}}
|
||||
</div>
|
||||
<div class="col-2" *ngIf="ep.airDateDisplay != 'Unknown'">
|
||||
{{ep.airDate | amLocal | amDateFormat: 'L' }}
|
||||
{{ep.airDate | amLocal | amUserLocale | amDateFormat: 'L' }}
|
||||
</div>
|
||||
<div class="col-2" *ngIf="ep.airDateDisplay == 'Unknown'">
|
||||
{{ep.airDateDisplay }}
|
||||
|
|
|
@ -61,13 +61,13 @@
|
|||
<th mat-header-cell *matHeaderCellDef> Next Request Due </th>
|
||||
<td mat-cell *matCellDef="let u">
|
||||
<div *ngIf="u.movieRequestQuota != null && u.movieRequestQuota.remaining != u.movieRequestLimit">
|
||||
{{'UserManagment.MovieDue' | translate: {date: (u.movieRequestQuota.nextRequest | amLocal | amDateFormat: 'l')} }}
|
||||
{{'UserManagment.MovieDue' | translate: {date: (u.movieRequestQuota.nextRequest | amLocal | amUserLocale | amDateFormat: 'l')} }}
|
||||
</div>
|
||||
<div *ngIf="u.episodeRequestQuota != null && u.episodeRequestQuota.remaining != u.episodeRequestLimit">
|
||||
{{'UserManagment.TvDue' | translate: {date: (u.episodeRequestQuota.nextRequest | amLocal | amDateFormat: 'l')} }}
|
||||
{{'UserManagment.TvDue' | translate: {date: (u.episodeRequestQuota.nextRequest | amLocal | amUserLocale | amDateFormat: 'l')} }}
|
||||
</div>
|
||||
<div *ngIf="u.musicRequestQuota != null && u.musicRequestQuota.remaining != u.musicRequestLimit">
|
||||
{{'UserManagment.MusicDue' | translate: {date: (u.musicRequestQuota.nextRequest | amLocal | amDateFormat: 'l')} }}
|
||||
{{'UserManagment.MusicDue' | translate: {date: (u.musicRequestQuota.nextRequest | amLocal | amUserLocale | amDateFormat: 'l')} }}
|
||||
</div>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
@ -75,7 +75,7 @@
|
|||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Last Logged In </th>
|
||||
<td mat-cell *matCellDef="let u">
|
||||
<span *ngIf="u.lastLoggedIn">
|
||||
{{u.lastLoggedIn | amFromUtc | amLocal | amDateFormat: 'l LT'}}
|
||||
{{u.lastLoggedIn | amFromUtc | amLocal | amUserLocale | amDateFormat: 'l LT'}}
|
||||
</span>
|
||||
<span *ngIf="!u.lastLoggedIn">
|
||||
Not logged in yet!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue