Skip to content

Commit

Permalink
Migrate away from swissDate #9896
Browse files Browse the repository at this point in the history
`DATE_PIPE_DEFAULT_OPTIONS` can gives use the exact same feature with
less code
  • Loading branch information
PowerKiKi committed Jun 13, 2024
1 parent 042a331 commit 044ed20
Show file tree
Hide file tree
Showing 24 changed files with 98 additions and 102 deletions.
4 changes: 2 additions & 2 deletions client/app/admin/accounts/accounts/accounts.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@

<ng-container matColumnDef="creationDate">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Créé le</th>
<td *matCellDef="let element" mat-cell>{{ element.item.creationDate | swissDate }}</td>
<td *matCellDef="let element" mat-cell>{{ element.item.creationDate | date }}</td>
</ng-container>

<ng-container matColumnDef="updateDate">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Modifié le</th>
<td *matCellDef="let element" mat-cell>{{ element.item.updateDate | swissDate }}</td>
<td *matCellDef="let element" mat-cell>{{ element.item.updateDate | date }}</td>
</ng-container>
</table>
</div>
Expand Down
11 changes: 5 additions & 6 deletions client/app/admin/accounts/accounts/accounts.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import {
AvailableColumn,
Button,
NaturalAbstractNavigableList,
NaturalAvatarComponent,
NaturalColumnsPickerComponent,
NaturalEnumPipe,
NaturalFixedButtonComponent,
NaturalSearchComponent,
NaturalTableButtonComponent,
NaturalAvatarComponent,
NaturalFixedButtonComponent,
NaturalEnumPipe,
NaturalSwissDatePipe,
} from '@ecodev/natural';
import {CommonModule, DatePipe} from '@angular/common';
import {CurrentUserForProfile} from '../../../shared/generated-types';
import {NaturalSearchFacetsService} from '../../../shared/natural-search/natural-search-facets.service';
import {AccountService} from '../services/account.service';
Expand All @@ -31,7 +31,6 @@ import {MatSortModule} from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table';
import {MatButtonModule} from '@angular/material/button';
import {RouterLink} from '@angular/router';
import {CommonModule} from '@angular/common';

type AccountingDialogData = never;
type AccountingClosingDialogResult = Date;
Expand Down Expand Up @@ -61,7 +60,7 @@ type AccountingExportDialogResult = {
MatPaginatorModule,
NaturalFixedButtonComponent,
NaturalEnumPipe,
NaturalSwissDatePipe,
DatePipe,
IbanPipe,
],
})
Expand Down
4 changes: 2 additions & 2 deletions client/app/admin/bookables/bookables/bookables.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
Dernière modification
</th>
<td *matCellDef="let element" mat-cell>
{{ element.updateDate | swissDate }}
{{ element.updateDate | date }}
</td>
<td *matFooterCellDef mat-footer-cell></td>
</ng-container>
Expand All @@ -192,7 +192,7 @@
Dernière vérification
</th>
<td *matCellDef="let element" mat-cell>
{{ element.verificationDate | swissDate }}
{{ element.verificationDate | date }}
</td>
<td *matFooterCellDef mat-footer-cell></td>
</ng-container>
Expand Down
11 changes: 5 additions & 6 deletions client/app/admin/bookables/bookables/bookables.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ import {MatTooltipModule} from '@angular/material/tooltip';
import {MatSortModule} from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table';
import {
NaturalAvatarComponent,
NaturalColumnsPickerComponent,
NaturalSearchComponent,
NaturalFileComponent,
NaturalTableButtonComponent,
NaturalAvatarComponent,
NaturalFixedButtonComponent,
NaturalSwissDatePipe,
NaturalSearchComponent,
NaturalTableButtonComponent,
} from '@ecodev/natural';
import {CommonModule} from '@angular/common';
import {CommonModule, DatePipe} from '@angular/common';

@Component({
selector: 'app-bookables',
Expand All @@ -45,7 +44,7 @@ import {CommonModule} from '@angular/common';
MatProgressSpinnerModule,
MatPaginatorModule,
NaturalFixedButtonComponent,
NaturalSwissDatePipe,
DatePipe,
],
})
export class BookablesComponent extends ParentComponent<BookableService> implements OnInit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import {NaturalSearchFacetsService} from '../../../shared/natural-search/natural
import {PermissionsService} from '../../../shared/services/permissions.service';
import {UsageBookableService} from '../services/usage-bookable.service';
import {
NaturalSearchSelections,
NaturalAvatarComponent,
NaturalColumnsPickerComponent,
NaturalSearchComponent,
NaturalFileComponent,
NaturalTableButtonComponent,
NaturalAvatarComponent,
NaturalFixedButtonComponent,
NaturalSwissDatePipe,
NaturalSearchComponent,
NaturalSearchSelections,
NaturalTableButtonComponent,
} from '@ecodev/natural';
import {CommonModule, DatePipe} from '@angular/common';
import {UsageBookables} from '../../../shared/generated-types';
import {BookingService} from '../../bookings/services/booking.service';
import {switchMap, takeUntil} from 'rxjs/operators';
Expand All @@ -26,7 +26,6 @@ import {FlagComponent} from '../../../shared/components/flag/flag.component';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatSortModule} from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table';
import {CommonModule} from '@angular/common';

@Component({
selector: 'app-usage-bookables',
Expand All @@ -49,7 +48,7 @@ import {CommonModule} from '@angular/common';
MatProgressSpinnerModule,
MatPaginatorModule,
NaturalFixedButtonComponent,
NaturalSwissDatePipe,
DatePipe,
],
})
export class UsageBookablesComponent extends ParentComponent<UsageBookableService> implements OnInit {
Expand Down
4 changes: 2 additions & 2 deletions client/app/admin/bookings/booking/booking.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ <h1 class="mat-headline-6">Sorties</h1>
<div class="nat-expand nat-vertical">
<div class="nat-horizontal nat-margin-bottom nat-gap-10 nat-align">
<h2 class="mat-headline-6 nat-no-margin-bottom">Début</h2>
<div>{{ data.model.startDate | swissDate }}</div>
<div>{{ data.model.startDate | date }}</div>
</div>
<mat-form-field>
<mat-label>Destination</mat-label>
Expand All @@ -195,7 +195,7 @@ <h2 class="mat-headline-6 nat-no-margin-bottom">Début</h2>
<div class="nat-expand nat-vertical">
<div class="nat-horizontal nat-margin-bottom nat-gap-10 nat-align">
<h2 class="mat-headline-6 nat-no-margin-bottom">Fin</h2>
<div class="nat-expand">{{ data.model.endDate | swissDate }}</div>
<div class="nat-expand">{{ data.model.endDate | date }}</div>
</div>
<mat-form-field>
<mat-label>Heure estimée de retour</mat-label>
Expand Down
4 changes: 2 additions & 2 deletions client/app/admin/bookings/booking/booking.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import {
NaturalSelectEnumComponent,
NaturalSeoResolveData,
NaturalStampComponent,
NaturalSwissDatePipe,
} from '@ecodev/natural';
import {DatePipe} from '@angular/common';
import {
availability,
code,
Expand Down Expand Up @@ -71,7 +71,7 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms';
UsageBookablesComponent,
NaturalStampComponent,
NaturalFixedButtonDetailComponent,
NaturalSwissDatePipe,
DatePipe,
],
})
export class BookingComponent extends NaturalAbstractDetail<BookingService, NaturalSeoResolveData> implements OnInit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import {BookingWithOwnerService} from '../services/booking-with-owner.service';
import {AbstractBookings} from './abstract-bookings';
import {
Button,
NaturalColumnsPickerComponent,
NaturalSearchComponent,
NaturalTableButtonComponent,
NaturalAvatarComponent,
NaturalColumnsPickerComponent,
NaturalEllipsisPipe,
NaturalEnumPipe,
NaturalFileComponent,
NaturalIconDirective,
NaturalFixedButtonComponent,
NaturalEnumPipe,
NaturalSwissDatePipe,
NaturalEllipsisPipe,
NaturalIconDirective,
NaturalSearchComponent,
NaturalTableButtonComponent,
} from '@ecodev/natural';
import {CommonModule, DatePipe} from '@angular/common';
import {CopyContactDataButtonService} from '../../../shared/components/copy-contact-data/copy-contact-data-button.service';
import {BookingsWithOwnerContactVariables} from '../../../shared/generated-types';
import {RouterLink} from '@angular/router';
Expand All @@ -28,7 +28,6 @@ import {MatButtonModule} from '@angular/material/button';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatSortModule} from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table';
import {CommonModule} from '@angular/common';

@Component({
selector: 'app-bookings-with-owner',
Expand All @@ -55,7 +54,7 @@ import {CommonModule} from '@angular/common';
NaturalFixedButtonComponent,
RouterLink,
NaturalEnumPipe,
NaturalSwissDatePipe,
DatePipe,
NaturalEllipsisPipe,
],
})
Expand Down
4 changes: 2 additions & 2 deletions client/app/admin/bookings/bookings/bookings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

<ng-container matColumnDef="startDate">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Début</th>
<td *matCellDef="let element" mat-cell>{{ element.startDate | swissDate }}</td>
<td *matCellDef="let element" mat-cell>{{ element.startDate | date }}</td>
<td *matFooterCellDef mat-footer-cell></td>
</ng-container>

Expand All @@ -141,7 +141,7 @@

<ng-container matColumnDef="endDate">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Fin</th>
<td *matCellDef="let element" mat-cell>{{ element.endDate | swissDate }}</td>
<td *matCellDef="let element" mat-cell>{{ element.endDate | date }}</td>
<td *matFooterCellDef mat-footer-cell></td>
</ng-container>

Expand Down
17 changes: 8 additions & 9 deletions client/app/admin/bookings/bookings/bookings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ import {MatTooltipModule} from '@angular/material/tooltip';
import {MatSortModule} from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table';
import {
NaturalColumnsPickerComponent,
NaturalSearchComponent,
NaturalTableButtonComponent,
NaturalAvatarComponent,
NaturalColumnsPickerComponent,
NaturalEllipsisPipe,
NaturalEnumPipe,
NaturalFileComponent,
NaturalIconDirective,
NaturalFixedButtonComponent,
NaturalEnumPipe,
NaturalSwissDatePipe,
NaturalEllipsisPipe,
NaturalIconDirective,
NaturalSearchComponent,
NaturalTableButtonComponent,
} from '@ecodev/natural';
import {CommonModule} from '@angular/common';
import {CommonModule, DatePipe} from '@angular/common';

@Component({
selector: 'app-bookings',
Expand All @@ -52,7 +51,7 @@ import {CommonModule} from '@angular/common';
NaturalFixedButtonComponent,
RouterLink,
NaturalEnumPipe,
NaturalSwissDatePipe,
DatePipe,
NaturalEllipsisPipe,
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
Dernière modification
</th>
<td *matCellDef="let element" mat-cell>
{{ element.updateDate | swissDate }}
{{ element.updateDate | date }}
</td>
</ng-container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import {Component, OnInit} from '@angular/core';
import {
AvailableColumn,
NaturalAbstractList,
NaturalAvatarComponent,
NaturalColumnsPickerComponent,
NaturalEnumPipe,
NaturalFixedButtonComponent,
NaturalIconDirective,
NaturalSearchComponent,
NaturalTableButtonComponent,
NaturalAvatarComponent,
NaturalIconDirective,
NaturalFixedButtonComponent,
NaturalEnumPipe,
NaturalSwissDatePipe,
} from '@ecodev/natural';
import {CommonModule, DatePipe} from '@angular/common';
import {NaturalSearchFacetsService} from '../../../shared/natural-search/natural-search-facets.service';
import {ExpenseClaimService} from '../services/expenseClaim.service';
import {PermissionsService} from '../../../shared/services/permissions.service';
Expand All @@ -23,7 +23,6 @@ import {MatButtonModule} from '@angular/material/button';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatSortModule} from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table';
import {CommonModule} from '@angular/common';

@Component({
selector: 'app-expense-claims',
Expand All @@ -48,7 +47,7 @@ import {CommonModule} from '@angular/common';
NaturalFixedButtonComponent,
RouterLink,
NaturalEnumPipe,
NaturalSwissDatePipe,
DatePipe,
],
})
export class ExpenseClaimsComponent extends NaturalAbstractList<ExpenseClaimService> implements OnInit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<ng-container matColumnDef="transactionDate">
<th *matHeaderCellDef mat-header-cell class="app-date-column" mat-sort-header>Date</th>
<td *matCellDef="let element" mat-cell>
{{ element.transactionDate | swissDate }}
{{ element.transactionDate | date }}
</td>
<td *matFooterCellDef mat-footer-cell></td>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import {
AvailableColumn,
Button,
NaturalAbstractList,
NaturalQueryVariablesManager,
NaturalAvatarComponent,
NaturalColumnsPickerComponent,
NaturalFixedButtonComponent,
NaturalQueryVariablesManager,
NaturalSearchComponent,
NaturalTableButtonComponent,
NaturalAvatarComponent,
NaturalFixedButtonComponent,
NaturalSwissDatePipe,
} from '@ecodev/natural';
import {DatePipe} from '@angular/common';
import {NaturalSearchFacetsService} from '../../../shared/natural-search/natural-search-facets.service';
import {TransactionLineService} from '../services/transactionLine.service';
import {
Expand Down Expand Up @@ -51,7 +51,7 @@ import {MatTableModule} from '@angular/material/table';
MatPaginatorModule,
NaturalFixedButtonComponent,
RouterLink,
NaturalSwissDatePipe,
DatePipe,
],
})
export class TransactionLinesComponent extends NaturalAbstractList<TransactionLineService> implements OnInit {
Expand Down
6 changes: 3 additions & 3 deletions client/app/admin/users/user/user.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -319,21 +319,21 @@ <h2 class="mat-headline-6">Portes</h2>
@if (isUpdatePage() && data.model.firstLogin) {
<div>
<span class="mat-subtitle-2">Première connexion :</span>
{{ data.model.firstLogin | swissDate }} ({{ data.model.firstLogin | timeAgo }})
{{ data.model.firstLogin | date }} ({{ data.model.firstLogin | timeAgo }})
</div>
}

@if (isUpdatePage() && data.model.lastLogin) {
<div>
<span class="mat-subtitle-2">Dernière connexion :</span>
{{ data.model.lastLogin | swissDate }} ({{ data.model.lastLogin | timeAgo }})
{{ data.model.lastLogin | date }} ({{ data.model.lastLogin | timeAgo }})
</div>
}

@if (isUpdatePage() && data.model.resignDate && data.model.status === 'archived') {
<div>
<span class="mat-subtitle-2">Démission le :</span>
{{ data.model.resignDate | swissDate }} ({{ data.model.resignDate | timeAgo }})
{{ data.model.resignDate | date }} ({{ data.model.resignDate | timeAgo }})
</div>
}
</div>
Expand Down
Loading

0 comments on commit 044ed20

Please sign in to comment.