fix dates

This commit is contained in:
_Bastler 2021-11-30 12:24:26 +01:00
parent 5350e45ce6
commit 8900b576a2
14 changed files with 31 additions and 32 deletions

View File

@ -25,7 +25,6 @@
"@angular/platform-browser": "^12.2.10",
"@angular/platform-browser-dynamic": "^12.2.10",
"@angular/router": "^12.2.10",
"moment": "^2.29.1",
"ng-qrcode": "^5.1.1",
"ngx-mat-timepicker": "^12.1.0",
"openpgp": "^4.10.10",

View File

@ -153,14 +153,14 @@ export class XhrInterceptor implements HttpInterceptor {
provide: NgxMatDateAdapter,
useClass: NgxMatMomentAdapter,
useFactory: (i18n: I18nService) => {
return new NgxMatMomentAdapter(i18n.getLocale());
return new NgxMatMomentAdapter(i18n.getLocale(), { strict: true });
}, deps: [ I18nService ]
}, {
provide: NGX_MAT_DATE_FORMATS, useFactory: (i18n: I18nService) => {
const datetimeformat = i18n.get('format.datetime', []);
return {
parse: {
dateInput: "l, LTS"
dateInput: datetimeformat
},
display: {
dateInput: datetimeformat,

View File

@ -90,7 +90,7 @@
<ng-container *ngFor="let slotForm of slots.controls; let i = index">
<div [formGroup]="slotForm" fxLayout="row wrap" fxLayoutAlign="start stretch" fxLayoutGap="24px grid">
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="slotStartPicker" readonly formControlName="start"
<input matInput [ngxMatDatetimePicker]="slotStartPicker" formControlName="start"
placeholder="{{'borrow.items.slot.start' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="slotStartPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #slotStartPicker></ngx-mat-datetime-picker>
@ -100,7 +100,7 @@
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="slotEndPicker" readonly formControlName="end"
<input matInput [ngxMatDatetimePicker]="slotEndPicker" formControlName="end"
placeholder="{{'borrow.items.slot.end' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="slotEndPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #slotEndPicker></ngx-mat-datetime-picker>

View File

@ -23,7 +23,7 @@
<form [formGroup]="form">
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="startPicker" readonly formControlName="start"
<input matInput [ngxMatDatetimePicker]="startPicker" formControlName="start"
placeholder="{{'borrow.request.start' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="startPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #startPicker></ngx-mat-datetime-picker>
@ -33,7 +33,7 @@
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="endPicker" readonly formControlName="end"
<input matInput [ngxMatDatetimePicker]="endPicker" formControlName="end"
placeholder="{{'borrow.request.end' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="endPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #endPicker></ngx-mat-datetime-picker>

View File

@ -29,12 +29,12 @@
<ng-container matColumnDef="starts">
<th mat-header-cell *matHeaderCellDef> {{'invite.starts' | i18n}} </th>
<td mat-cell *matCellDef="let invite"> {{ invite.starts | date:datetimeformat}} </td>
<td mat-cell *matCellDef="let invite"> {{ invite.starts | datef:datetimeformat}} </td>
</ng-container>
<ng-container matColumnDef="expires">
<th mat-header-cell *matHeaderCellDef> {{'invite.expires' | i18n}} </th>
<td mat-cell *matCellDef="let invite"> {{ invite.expires | date:datetimeformat}} </td>
<td mat-cell *matCellDef="let invite"> {{ invite.expires | datef:datetimeformat}} </td>
</ng-container>
<ng-container matColumnDef="link">

View File

@ -35,18 +35,18 @@
<ng-container matColumnDef="starts">
<th mat-header-cell *matHeaderCellDef mat-sort-header="starts"> {{'jitsi.rooms.starts' | i18n}} </th>
<td mat-cell *matCellDef="let jitsiRoom">{{ jitsiRoom.starts | date:datetimeformat}} </td>
<td mat-cell *matCellDef="let jitsiRoom">{{ jitsiRoom.starts | datef:datetimeformat}} </td>
</ng-container>
<ng-container matColumnDef="moderationStarts">
<th mat-header-cell *matHeaderCellDef mat-sort-header="moderationStarts"> {{'jitsi.rooms.moderationStarts' |
i18n}} </th>
<td mat-cell *matCellDef="let jitsiRoom">{{ jitsiRoom.moderationStarts | date:datetimeformat}} </td>
<td mat-cell *matCellDef="let jitsiRoom">{{ jitsiRoom.moderationStarts | datef:datetimeformat}} </td>
</ng-container>
<ng-container matColumnDef="expires">
<th mat-header-cell *matHeaderCellDef mat-sort-header="expires"> {{'jitsi.rooms.expires' | i18n}} </th>
<td mat-cell *matCellDef="let jitsiRoom"> {{ jitsiRoom.expires | date:datetimeformat}} </td>
<td mat-cell *matCellDef="let jitsiRoom"> {{ jitsiRoom.expires | datef:datetimeformat}} </td>
</ng-container>
<ng-container matColumnDef="moderationUrl">
@ -107,7 +107,7 @@
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="startsPicker" readonly [(ngModel)]="jitsiRoom.starts" formControlName="starts"
<input matInput [ngxMatDatetimePicker]="startsPicker" [(ngModel)]="jitsiRoom.starts" formControlName="starts"
placeholder="{{'jitsi.rooms.starts' | i18n}}" (dateChange)="clearModeration(jitsiRoom)">
<mat-datepicker-toggle matSuffix [for]="startsPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #startsPicker></ngx-mat-datetime-picker>
@ -117,7 +117,7 @@
</mat-form-field>
<mat-form-field *ngIf="jitsiRoom.starts">
<input matInput [ngxMatDatetimePicker]="moderationStartsPicker" readonly [(ngModel)]="jitsiRoom.moderationStarts"
<input matInput [ngxMatDatetimePicker]="moderationStartsPicker" [(ngModel)]="jitsiRoom.moderationStarts"
formControlName="moderationStarts" placeholder="{{'jitsi.rooms.moderationStarts' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="moderationStartsPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #moderationStartsPicker></ngx-mat-datetime-picker>
@ -127,7 +127,7 @@
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="expiresPicker" readonly [(ngModel)]="jitsiRoom.expires"
<input matInput [ngxMatDatetimePicker]="expiresPicker" [(ngModel)]="jitsiRoom.expires"
formControlName="expires" placeholder="{{'jitsi.rooms.expires' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="expiresPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #expiresPicker></ngx-mat-datetime-picker>

View File

@ -12,7 +12,7 @@
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="startsPicker" readonly [(ngModel)]="jitsiRoom.starts" formControlName="starts"
<input matInput [ngxMatDatetimePicker]="startsPicker" [(ngModel)]="jitsiRoom.starts" formControlName="starts"
placeholder="{{'jitsi.rooms.starts' | i18n}}" (dateChange)="clearModeration(jitsiRoom)">
<mat-datepicker-toggle matSuffix [for]="startsPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #startsPicker></ngx-mat-datetime-picker>
@ -22,7 +22,7 @@
</mat-form-field>
<mat-form-field *ngIf="jitsiRoom.starts">
<input matInput [ngxMatDatetimePicker]="moderationStartsPicker" readonly [(ngModel)]="jitsiRoom.moderationStarts"
<input matInput [ngxMatDatetimePicker]="moderationStartsPicker" [(ngModel)]="jitsiRoom.moderationStarts"
formControlName="moderationStarts" placeholder="{{'jitsi.rooms.moderationStarts' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="moderationStartsPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #moderationStartsPicker></ngx-mat-datetime-picker>
@ -32,7 +32,7 @@
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="expiresPicker" readonly [(ngModel)]="jitsiRoom.expires" formControlName="expires"
<input matInput [ngxMatDatetimePicker]="expiresPicker" [(ngModel)]="jitsiRoom.expires" formControlName="expires"
placeholder="{{'jitsi.rooms.expires' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="expiresPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #expiresPicker></ngx-mat-datetime-picker>

View File

@ -17,7 +17,7 @@
<textarea [mat-autosize] matInput [value]="timeslot.secret" readonly placeholder="{{'partey.timeslots.secret' | i18n}}"></textarea>
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="startsPicker" readonly [(ngModel)]="timeslot.starts" formControlName="starts"
<input matInput [ngxMatDatetimePicker]="startsPicker" [(ngModel)]="timeslot.starts" formControlName="starts"
placeholder="{{'partey.timeslots.starts' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="startsPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #startsPicker></ngx-mat-datetime-picker>
@ -26,7 +26,7 @@
</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="endsPicker" readonly [(ngModel)]="timeslot.ends" formControlName="ends"
<input matInput [ngxMatDatetimePicker]="endsPicker" [(ngModel)]="timeslot.ends" formControlName="ends"
placeholder="{{'partey.timeslots.ends' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="endsPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #endsPicker></ngx-mat-datetime-picker>

View File

@ -28,7 +28,7 @@
</mat-select>
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="afterPicker" readonly [formControl]="afterFormControl"
<input matInput [ngxMatDatetimePicker]="afterPicker" [formControl]="afterFormControl"
placeholder="{{'partey.timeslots.filter.after' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="afterPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #afterPicker></ngx-mat-datetime-picker>
@ -37,12 +37,12 @@
<table mat-table matSort [dataSource]="timeslots.content" (matSortChange)="updateSort($event)">
<ng-container matColumnDef="starts">
<th mat-header-cell *matHeaderCellDef mat-sort-header="starts"> {{'partey.timeslots.starts' | i18n}} </th>
<td mat-cell *matCellDef="let timeslot">{{ timeslot.starts | date:datetimeformat}} </td>
<td mat-cell *matCellDef="let timeslot">{{ timeslot.starts | datef:datetimeformat}} </td>
</ng-container>
<ng-container matColumnDef="ends">
<th mat-header-cell *matHeaderCellDef mat-sort-header="ends"> {{'partey.timeslots.ends' | i18n}} </th>
<td mat-cell *matCellDef="let timeslot"> {{ timeslot.ends | date:datetimeformat}} </td>
<td mat-cell *matCellDef="let timeslot"> {{ timeslot.ends | datef:datetimeformat}} </td>
</ng-container>
<ng-container matColumnDef="title">

View File

@ -46,7 +46,7 @@
<ng-container matColumnDef="expires">
<th mat-header-cell *matHeaderCellDef mat-sort-header="expires"> {{'urlshortener.expires' | i18n}} </th>
<td mat-cell *matCellDef="let shortenedUrl"> {{ shortenedUrl.expires | date:datetimeformat}} </td>
<td mat-cell *matCellDef="let shortenedUrl"> {{ shortenedUrl.expires | datef:datetimeformat}} </td>
</ng-container>
<ng-container matColumnDef="edit">
@ -124,7 +124,7 @@
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="expiresPicker" readonly [(ngModel)]="shortenedUrl.expires"
<input matInput [ngxMatDatetimePicker]="expiresPicker" [(ngModel)]="shortenedUrl.expires"
formControlName="expires" placeholder="{{'urlshortener.expires' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="expiresPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #expiresPicker></ngx-mat-datetime-picker>

View File

@ -49,7 +49,7 @@
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="expiresPicker" readonly [(ngModel)]="shortenedUrlModel.expires"
<input matInput [ngxMatDatetimePicker]="expiresPicker" [(ngModel)]="shortenedUrlModel.expires"
formControlName="expires" placeholder="{{'urlshortener.expires' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="expiresPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #expiresPicker></ngx-mat-datetime-picker>

View File

@ -12,12 +12,12 @@
<ng-container matColumnDef="starts">
<th mat-header-cell *matHeaderCellDef mat-sort-header="starts"> {{'permissions.starts' | i18n}} </th>
<td mat-cell *matCellDef="let permission">{{permission.starts | date:datetimeformat}}</td>
<td mat-cell *matCellDef="let permission">{{permission.starts | datef:datetimeformat}}</td>
</ng-container>
<ng-container matColumnDef="expires">
<th mat-header-cell *matHeaderCellDef mat-sort-header="expires"> {{'permissions.expires' | i18n}} </th>
<td mat-cell *matCellDef="let permission">{{permission.expires | date:datetimeformat}}</td>
<td mat-cell *matCellDef="let permission">{{permission.expires | datef:datetimeformat}}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="permissionColumns"></tr>

View File

@ -38,7 +38,7 @@
</mat-error>
</mat-form-field>
<mat-form-field *ngSwitchCase="'DATETIME'">
<input matInput [ngxMatDatetimePicker]="datetimePicker" readonly [(ngModel)]="profileField.value" formControlName="value"
<input matInput [ngxMatDatetimePicker]="datetimePicker" [(ngModel)]="profileField.value" formControlName="value"
placeholder="{{'profileField.value' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="datetimePicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #datetimePicker></ngx-mat-datetime-picker>

View File

@ -10,9 +10,9 @@
<td mat-cell *matCellDef="let profileField">
<div [ngSwitch]="profileField.type">
<span *ngSwitchCase="'TEXT'">{{profileField.value}}</span>
<span *ngSwitchCase="'DATE'">{{profileField.value | date:dateformat}}</span>
<span *ngSwitchCase="'DATETIME'">{{profileField.value | date:datetimeformat}}</span>
<span *ngSwitchCase="'TIME'">{{profileField.value | date:timeformat}}</span>
<span *ngSwitchCase="'DATE'">{{profileField.value | datef:dateformat}}</span>
<span *ngSwitchCase="'DATETIME'">{{profileField.value | datef:datetimeformat}}</span>
<span *ngSwitchCase="'TIME'">{{profileField.value | datef:timeformat}}</span>
<a *ngSwitchCase="'URL'" class="accent" href="{{profileField.value}}">{{profileField.value}}</a>
<a *ngSwitchCase="'EMAIL'" class="accent" href="mailto:{{profileField.value}}">{{profileField.value}}</a>
<span *ngSwitchCase="'NUMBER'">{{profileField.value}}</span>