From b33beeb6699afea13269fa1d653701e9b0e040ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Wed, 27 Sep 2023 16:24:38 +0200 Subject: [PATCH] feat: date-fns --- .../app/modules/assessments/assessments.module.ts | 4 ++-- .../types/assessment/assessment-list-item.html | 3 ++- .../modules/calendar/add-event-review-modal.html | 2 +- .../src/app/modules/calendar/calendar.module.ts | 4 ++-- .../app/modules/dashboard/dashboard.component.html | 2 +- .../src/app/modules/dashboard/dashboard.module.ts | 4 ++-- .../modules/data/chips/edit-event-selection.html | 12 ++++++------ frontend/app/src/app/modules/data/data.module.ts | 14 ++++++-------- .../app/modules/data/elements/offers-detail.html | 2 +- .../app/modules/data/elements/origin-detail.html | 10 +++++----- .../date-series/date-series-detail-content.html | 8 ++++---- .../types/date-series/date-series-list-item.html | 8 ++++---- .../data/types/message/message-detail-content.html | 4 ++-- .../types/semester/semester-detail-content.html | 2 +- .../data/types/semester/semester-list-item.html | 4 ++-- .../data/types/video/video-detail-content.html | 2 +- .../modules/data/types/video/video-list-item.html | 2 +- .../hebis/daia-availability/daia-holding.html | 2 +- frontend/app/src/app/modules/hebis/hebis.module.ts | 4 ++-- .../account/elements/fee-item/fee-item.html | 2 +- .../account/elements/paia-item/paiaitem.html | 2 +- .../library/account/profile/profile-page.html | 2 +- .../app/src/app/modules/library/library.module.ts | 4 ++-- .../app/src/app/modules/news/item/news-item.html | 2 +- frontend/app/src/app/modules/news/news.module.ts | 4 ++-- .../src/app/modules/profile/page/my-courses.html | 4 ++-- .../app/src/app/modules/profile/profile.module.ts | 3 +-- .../app/modules/schedule/page/calendar-view.html | 2 +- .../modules/schedule/page/grid/schedule-day.html | 2 +- .../schedule/page/schedule-single-events.html | 2 +- .../app/modules/schedule/page/schedule-view.html | 2 +- .../src/app/modules/schedule/schedule.module.ts | 6 +++--- frontend/app/src/app/translation/dfns-locale.ts | 6 +++--- .../translation/property-name-translate.pipe.ts | 6 +++--- frontend/app/src/app/util/opening-hours.html | 4 ++-- frontend/app/src/app/util/util.module.ts | 6 +++--- frontend/app/src/assets/i18n/de.json | 2 +- frontend/app/src/assets/i18n/en.json | 2 +- 38 files changed, 77 insertions(+), 79 deletions(-) diff --git a/frontend/app/src/app/modules/assessments/assessments.module.ts b/frontend/app/src/app/modules/assessments/assessments.module.ts index 8412ead9..b620c9c2 100644 --- a/frontend/app/src/app/modules/assessments/assessments.module.ts +++ b/frontend/app/src/app/modules/assessments/assessments.module.ts @@ -35,7 +35,7 @@ import {ProtectedRoutes} from '../auth/protected.routes'; import {AssessmentsTreeListComponent} from './list/assessments-tree-list.component'; import {IonIconModule} from '../../util/ion-icon/ion-icon.module'; import {UtilModule} from '../../util/util.module'; -import {FormatPipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; +import {FormatPurePipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; const routes: ProtectedRoutes = [ { @@ -76,7 +76,7 @@ const routes: ProtectedRoutes = [ ThingTranslateModule, UtilModule, ParseIsoPipeModule, - FormatPipeModule, + FormatPurePipeModule, ], providers: [AssessmentsProvider], exports: [], diff --git a/frontend/app/src/app/modules/assessments/types/assessment/assessment-list-item.html b/frontend/app/src/app/modules/assessments/types/assessment/assessment-list-item.html index 8d5f8e37..fc00be42 100644 --- a/frontend/app/src/app/modules/assessments/types/assessment/assessment-list-item.html +++ b/frontend/app/src/app/modules/assessments/types/assessment/assessment-list-item.html @@ -15,7 +15,8 @@

- {{ 'name' | thingTranslate : item }} {{ item.date ? (item.date | dfnsParseIso | dfnsFormat : 'Pp') : '' }} + {{ 'name' | thingTranslate : item }} {{ item.date ? (item.date | dfnsParseIso | dfnsFormatPure : 'Pp') : + '' }}

diff --git a/frontend/app/src/app/modules/calendar/add-event-review-modal.html b/frontend/app/src/app/modules/calendar/add-event-review-modal.html index 1e4e6560..580fb3ed 100644 --- a/frontend/app/src/app/modules/calendar/add-event-review-modal.html +++ b/frontend/app/src/app/modules/calendar/add-event-review-modal.html @@ -34,7 +34,7 @@ - {{ iCalEvent.start | dfnsParseIso | dfnsFormat : 'PPPp' }} + {{ iCalEvent.start | dfnsParseIso | dfnsFormatPure : 'PPPp' }} {{ iCalEvent.rrule.interval }} {{ iCalEvent.rrule.freq | sentencecase }} diff --git a/frontend/app/src/app/modules/calendar/calendar.module.ts b/frontend/app/src/app/modules/calendar/calendar.module.ts index e033304b..3726477d 100644 --- a/frontend/app/src/app/modules/calendar/calendar.module.ts +++ b/frontend/app/src/app/modules/calendar/calendar.module.ts @@ -24,7 +24,7 @@ import {FormsModule} from '@angular/forms'; import {CommonModule} from '@angular/common'; import {UtilModule} from '../../util/util.module'; import {IonIconModule} from '../../util/ion-icon/ion-icon.module'; -import {FormatPipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; +import {FormatPurePipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; @NgModule({ declarations: [AddEventReviewModalComponent], @@ -37,7 +37,7 @@ import {FormatPipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; CommonModule, UtilModule, ParseIsoPipeModule, - FormatPipeModule, + FormatPurePipeModule, ], exports: [], providers: [Calendar, CalendarService, ScheduleProvider], diff --git a/frontend/app/src/app/modules/dashboard/dashboard.component.html b/frontend/app/src/app/modules/dashboard/dashboard.component.html index df4ef463..48f9e090 100644 --- a/frontend/app/src/app/modules/dashboard/dashboard.component.html +++ b/frontend/app/src/app/modules/dashboard/dashboard.component.html @@ -33,7 +33,7 @@ {{ nextEvent - ? (nextEvent!.dates.sort().at(-1) | dfnsParseIso | dfnsFormatRelative : (now | async)) + ? (nextEvent!.dates.sort().at(-1) | dfnsParseIso | dfnsFormatRelativePure : (now | async)) : ('dashboard.schedule.noEvent' | translate) }} diff --git a/frontend/app/src/app/modules/dashboard/dashboard.module.ts b/frontend/app/src/app/modules/dashboard/dashboard.module.ts index 8dd7981c..3660e4c9 100644 --- a/frontend/app/src/app/modules/dashboard/dashboard.module.ts +++ b/frontend/app/src/app/modules/dashboard/dashboard.module.ts @@ -31,7 +31,7 @@ import {ThingTranslateModule} from '../../translation/thing-translate.module'; import {UtilModule} from '../../util/util.module'; import {IonIconModule} from '../../util/ion-icon/ion-icon.module'; import {NewsModule} from '../news/news.module'; -import {FormatRelativePipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; +import {FormatRelativePurePipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; const catalogRoutes: Routes = [ { @@ -65,7 +65,7 @@ const catalogRoutes: Routes = [ UtilModule, NewsModule, ParseIsoPipeModule, - FormatRelativePipeModule, + FormatRelativePurePipeModule, ], providers: [SettingsProvider, TranslatePipe], }) diff --git a/frontend/app/src/app/modules/data/chips/edit-event-selection.html b/frontend/app/src/app/modules/data/chips/edit-event-selection.html index c9851109..b3725713 100644 --- a/frontend/app/src/app/modules/data/chips/edit-event-selection.html +++ b/frontend/app/src/app/modules/data/chips/edit-event-selection.html @@ -44,19 +44,19 @@ > - {{ date.item.duration | dfnsParseDuration | dfnsFormatDuration }} - {{ date.item.dates[0] | dfnsParseIso | dfnsFormat: 'EEEE, p' }} + {{ date.item.duration | dfnsParseDuration | dfnsFormatDurationPure }} + {{ date.item.dates[0] | dfnsParseIso | dfnsFormatPure: 'EEEE, p' }}
- {{ date.item.dates[0] | dfnsParseIso | dfnsFormat: 'PPP' }} - {{ - date.item.dates[date.item.dates.length - 1] | dfnsParseIso | dfnsFormat: 'PPP' }} + {{ date.item.dates[0] | dfnsParseIso | dfnsFormatPure: 'PPP' }} - {{ + date.item.dates[date.item.dates.length - 1] | dfnsParseIso | dfnsFormatPure: 'PPP' }}
- {{ date.item.duration |dfnsParseDuration | dfnsFormatDuration}} - {{ time | dfnsParseIso | dfnsFormat: 'PPPPp' }} + {{ date.item.duration |dfnsParseDuration | dfnsFormatDurationPure}} + {{ time | dfnsParseIso | dfnsFormatPure: 'PPPPp' }} {{ 'data.chips.add_events.popover.DATA_ERROR' | translate }} diff --git a/frontend/app/src/app/modules/data/data.module.ts b/frontend/app/src/app/modules/data/data.module.ts index 7106f0c7..00fdb856 100644 --- a/frontend/app/src/app/modules/data/data.module.ts +++ b/frontend/app/src/app/modules/data/data.module.ts @@ -104,10 +104,9 @@ import {CertificationsInDetailComponent} from './elements/certifications-in-deta import {GeoNavigationDirective} from '../map/geo-navigation.directive'; import {NavigateActionChipComponent} from './chips/data/navigate-action-chip.component'; import { - FormatDistanceToNowPipeModule, - FormatDurationPipeModule, - FormatPipeModule, - FormatRelativeToNowPipeModule, + FormatDurationPurePipeModule, + FormatPurePipeModule, + FormatRelativeToNowPurePipeModule, ParseIsoPipeModule, } from 'ngx-date-fns'; import {ParseDurationPipe} from '../../translation/date-time/parse-duration.pipe'; @@ -203,13 +202,12 @@ import {DfnsFormatRelativeDatePurePipe} from '../../translation/date-time/format UtilModule, GeoNavigationDirective, ParseIsoPipeModule, - FormatPipeModule, ParseDurationPipe, - FormatDurationPipeModule, - FormatRelativeToNowPipeModule, DfnsFormatFrequencyPurePipe, - FormatDistanceToNowPipeModule, DfnsFormatRelativeDatePurePipe, + FormatPurePipeModule, + FormatDurationPurePipeModule, + FormatRelativeToNowPurePipeModule, ], providers: [ CoordinatedSearchProvider, diff --git a/frontend/app/src/app/modules/data/elements/offers-detail.html b/frontend/app/src/app/modules/data/elements/offers-detail.html index 5a854b19..53baf16f 100644 --- a/frontend/app/src/app/modules/data/elements/offers-detail.html +++ b/frontend/app/src/app/modules/data/elements/offers-detail.html @@ -30,7 +30,7 @@ *ngIf="offer.availabilityRange.gt ? offer.availabilityRange.gt : offer.availabilityRange.gte" > {{ (offer.availabilityRange.gt ? offer.availabilityRange.gt : offer.availabilityRange.gte) | - dfnsParseIso | dfnsFormat : 'PPP' }} + dfnsParseIso | dfnsFormatPure : 'PPP' }} diff --git a/frontend/app/src/app/modules/data/elements/origin-detail.html b/frontend/app/src/app/modules/data/elements/origin-detail.html index 73614a17..d900f3ac 100644 --- a/frontend/app/src/app/modules/data/elements/origin-detail.html +++ b/frontend/app/src/app/modules/data/elements/origin-detail.html @@ -21,15 +21,15 @@

{{ 'data.types.origin.detail.CREATED' | translate | titlecase }}: {{ origin.created | dfnsParseIso | - dfnsFormat : 'PPP' }} + dfnsFormatPure : 'PPP' }}

{{ 'data.types.origin.detail.UPDATED' | translate | titlecase }}: {{ origin.updated | dfnsParseIso | - dfnsFormat : 'PPP' }} + dfnsFormatPure : 'PPP' }}

{{ 'data.types.origin.detail.MODIFIED' | translate | titlecase }}: {{ origin.modified | dfnsParseIso | - dfnsFormat : 'PPP' }} + dfnsFormatPure : 'PPP' }}

{{ 'data.types.origin.detail.MAINTAINER' | translate }}: {{ origin.name }}

@@ -47,11 +47,11 @@

{{ 'data.types.origin.detail.INDEXED' | translate | titlecase }}: {{ origin.indexed | dfnsParseIso | - dfnsFormat : 'PPP'}} + dfnsFormatPure : 'PPP'}}

{{ 'data.types.origin.detail.MODIFIED' | translate | titlecase }}: {{ origin.modified | dfnsParseIso | - dfnsFormat : 'PPP' }} + dfnsFormatPure : 'PPP' }}

{{ 'data.types.origin.detail.MAINTAINER' | translate }}: {{ origin.name }}

diff --git a/frontend/app/src/app/modules/data/types/date-series/date-series-detail-content.html b/frontend/app/src/app/modules/data/types/date-series/date-series-detail-content.html index 11749bb8..c5c22b56 100644 --- a/frontend/app/src/app/modules/data/types/date-series/date-series-detail-content.html +++ b/frontend/app/src/app/modules/data/types/date-series/date-series-detail-content.html @@ -26,22 +26,22 @@ diff --git a/frontend/app/src/app/modules/data/types/date-series/date-series-list-item.html b/frontend/app/src/app/modules/data/types/date-series/date-series-list-item.html index be6ddd9c..2c68afd3 100644 --- a/frontend/app/src/app/modules/data/types/date-series/date-series-list-item.html +++ b/frontend/app/src/app/modules/data/types/date-series/date-series-list-item.html @@ -22,12 +22,12 @@ - {{ item.repeatFrequency | dfnsParseDuration | dfnsFormatDuration | sentencecase }}, {{ - item.dates[0] | dfnsParseIso | dfnsFormat : 'PPPP' }} + {{ item.repeatFrequency | dfnsParseDuration | dfnsFormatDurationPure | sentencecase }}, {{ + item.dates[0] | dfnsParseIso | dfnsFormatPure : 'PPPP' }} - ({{ item.dates[0] | dfnsParseIso | dfnsFormat: 'PPP' }} - {{ item.dates[item.dates.length - 1] | - dfnsParseIso | dfnsFormat: 'PPP' }}) + ({{ item.dates[0] | dfnsParseIso | dfnsFormatPure: 'PPP' }} - {{ item.dates[item.dates.length - + 1] | dfnsParseIso | dfnsFormatPure: 'PPP' }})

diff --git a/frontend/app/src/app/modules/data/types/message/message-detail-content.html b/frontend/app/src/app/modules/data/types/message/message-detail-content.html index 334699f3..810f3709 100644 --- a/frontend/app/src/app/modules/data/types/message/message-detail-content.html +++ b/frontend/app/src/app/modules/data/types/message/message-detail-content.html @@ -25,7 +25,7 @@ diff --git a/frontend/app/src/app/modules/data/types/semester/semester-detail-content.html b/frontend/app/src/app/modules/data/types/semester/semester-detail-content.html index d6c28c07..178e8598 100644 --- a/frontend/app/src/app/modules/data/types/semester/semester-detail-content.html +++ b/frontend/app/src/app/modules/data/types/semester/semester-detail-content.html @@ -21,6 +21,6 @@ ('eventsEndDate' | propertyNameTranslate : item | titlecase) " [content]=" - (item.eventsStartDate | dfnsParseIso | dfnsFormat : 'PPP') + ' - ' + (item.eventsEndDate | dfnsParseIso | dfnsFormat : 'PPP') + (item.eventsStartDate | dfnsParseIso | dfnsFormatPure : 'PPP') + ' - ' + (item.eventsEndDate | dfnsParseIso | dfnsFormat : 'PPP') " > diff --git a/frontend/app/src/app/modules/data/types/semester/semester-list-item.html b/frontend/app/src/app/modules/data/types/semester/semester-list-item.html index 403c5834..10741712 100644 --- a/frontend/app/src/app/modules/data/types/semester/semester-list-item.html +++ b/frontend/app/src/app/modules/data/types/semester/semester-list-item.html @@ -21,8 +21,8 @@

{{ item.startDate | dfnsParseIso | dfnsFormat: 'PPP' }} - {{ item.endDate | dfnsParseIso | - dfnsFormat: 'PPP' }}{{ item.startDate | dfnsParseIso | dfnsFormatPure: 'PPP' }} - {{ item.endDate | dfnsParseIso | + dfnsFormatPure: 'PPP' }}

{{ 'type' | thingTranslate : item }} diff --git a/frontend/app/src/app/modules/data/types/video/video-detail-content.html b/frontend/app/src/app/modules/data/types/video/video-detail-content.html index 4aaec145..51d26683 100644 --- a/frontend/app/src/app/modules/data/types/video/video-detail-content.html +++ b/frontend/app/src/app/modules/data/types/video/video-detail-content.html @@ -26,7 +26,7 @@ diff --git a/frontend/app/src/app/modules/data/types/video/video-list-item.html b/frontend/app/src/app/modules/data/types/video/video-list-item.html index 4328582e..a55a4c0a 100644 --- a/frontend/app/src/app/modules/data/types/video/video-list-item.html +++ b/frontend/app/src/app/modules/data/types/video/video-list-item.html @@ -11,7 +11,7 @@

{{ 'duration' | propertyNameTranslate : item | titlecase }}: {{ item.duration | dfnsParseDuration | - dfnsFormatDuration : {format: ['seconds']} }} + dfnsFormatDurationPure : {format: ['seconds']} }}

{{ 'type' | thingTranslate : item }} diff --git a/frontend/app/src/app/modules/hebis/daia-availability/daia-holding.html b/frontend/app/src/app/modules/hebis/daia-availability/daia-holding.html index c45c137e..f2b66881 100644 --- a/frontend/app/src/app/modules/hebis/daia-availability/daia-holding.html +++ b/frontend/app/src/app/modules/hebis/daia-availability/daia-holding.html @@ -67,6 +67,6 @@ {{ 'hebisSearch.daia.dueDate' | translate }} - {{ holding.dueDate | dfnsParseIso | dfnsFormat : 'PPP' }} + {{ holding.dueDate | dfnsParseIso | dfnsFormatPure : 'PPP' }} diff --git a/frontend/app/src/app/modules/hebis/hebis.module.ts b/frontend/app/src/app/modules/hebis/hebis.module.ts index 2344c47a..a28f6bc7 100644 --- a/frontend/app/src/app/modules/hebis/hebis.module.ts +++ b/frontend/app/src/app/modules/hebis/hebis.module.ts @@ -35,7 +35,7 @@ import {DaiaAvailabilityComponent} from './daia-availability/daia-availability.c import {UtilModule} from '../../util/util.module'; import {IonIconModule} from '../../util/ion-icon/ion-icon.module'; import {DaiaHoldingComponent} from './daia-availability/daia-holding.component'; -import {FormatPipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; +import {FormatPurePipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; /** * Module for handling data @@ -64,7 +64,7 @@ import {FormatPipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; ThingTranslateModule.forChild(), UtilModule, ParseIsoPipeModule, - FormatPipeModule, + FormatPurePipeModule, ], providers: [HebisDataProvider, DaiaDataProvider, StAppsWebHttpClient], }) diff --git a/frontend/app/src/app/modules/library/account/elements/fee-item/fee-item.html b/frontend/app/src/app/modules/library/account/elements/fee-item/fee-item.html index f317dd4c..f600a49b 100644 --- a/frontend/app/src/app/modules/library/account/elements/fee-item/fee-item.html +++ b/frontend/app/src/app/modules/library/account/elements/fee-item/fee-item.html @@ -28,7 +28,7 @@

{{ 'library.account.pages.fines.labels' + '.' + property | translate }}: {{ fee[property] }} - {{ $any(fee[property]) | dfnsParseIso | dfnsFormat : 'PPP' }} + {{ $any(fee[property]) | dfnsParseIso | dfnsFormatPure : 'PPP' }}

diff --git a/frontend/app/src/app/modules/library/account/elements/paia-item/paiaitem.html b/frontend/app/src/app/modules/library/account/elements/paia-item/paiaitem.html index 8bc7e5af..2ba46d70 100644 --- a/frontend/app/src/app/modules/library/account/elements/paia-item/paiaitem.html +++ b/frontend/app/src/app/modules/library/account/elements/paia-item/paiaitem.html @@ -23,7 +23,7 @@ {{ item[property] }} - {{ $any(item[property]) | dfnsParseIso | dfnsFormat : 'PPP' }} + {{ $any(item[property]) | dfnsParseIso | dfnsFormatPure : 'PPP' }}

diff --git a/frontend/app/src/app/modules/library/account/profile/profile-page.html b/frontend/app/src/app/modules/library/account/profile/profile-page.html index dc847546..d36cce34 100644 --- a/frontend/app/src/app/modules/library/account/profile/profile-page.html +++ b/frontend/app/src/app/modules/library/account/profile/profile-page.html @@ -38,7 +38,7 @@ {{ 'library.account.pages.profile.values.expires' | translate }}: {{ - $any(patron[property]) | dfnsParseIso | dfnsFormat : 'PPP' }} + $any(patron[property]) | dfnsParseIso | dfnsFormatPure : 'PPP' }}
diff --git a/frontend/app/src/app/modules/library/library.module.ts b/frontend/app/src/app/modules/library/library.module.ts index e0c7fff8..5e5a1a96 100644 --- a/frontend/app/src/app/modules/library/library.module.ts +++ b/frontend/app/src/app/modules/library/library.module.ts @@ -31,7 +31,7 @@ import {FeeItemComponent} from './account/elements/fee-item/fee-item.component'; import {DataModule} from '../data/data.module'; import {UtilModule} from '../../util/util.module'; import {IonIconModule} from '../../util/ion-icon/ion-icon.module'; -import {FormatPipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; +import {FormatPurePipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; const routes: ProtectedRoutes | Routes = [ { @@ -77,7 +77,7 @@ const routes: ProtectedRoutes | Routes = [ DataModule, UtilModule, ParseIsoPipeModule, - FormatPipeModule, + FormatPurePipeModule, ], declarations: [ LibraryAccountPageComponent, diff --git a/frontend/app/src/app/modules/news/item/news-item.html b/frontend/app/src/app/modules/news/item/news-item.html index 16e0cc26..cf82d1e2 100644 --- a/frontend/app/src/app/modules/news/item/news-item.html +++ b/frontend/app/src/app/modules/news/item/news-item.html @@ -21,7 +21,7 @@ > {{ item.datePublished | dfnsParseIso | dfnsFormatRelativeToNow | sentencecase }}{{ item.datePublished | dfnsParseIso | dfnsFormatRelativeToNowPure | sentencecase }} {{ item.name }} diff --git a/frontend/app/src/app/modules/news/news.module.ts b/frontend/app/src/app/modules/news/news.module.ts index ef603827..2bd89a04 100644 --- a/frontend/app/src/app/modules/news/news.module.ts +++ b/frontend/app/src/app/modules/news/news.module.ts @@ -28,7 +28,7 @@ import {SettingsModule} from '../settings/settings.module'; import {NewsSettingsFilterComponent} from './elements/news-filter-settings/news-settings-filter.component'; import {UtilModule} from '../../util/util.module'; import {IonIconModule} from '../../util/ion-icon/ion-icon.module'; -import {FormatRelativeToNowPipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; +import {FormatRelativeToNowPurePipeModule, ParseIsoPipeModule} from 'ngx-date-fns'; const newsRoutes: Routes = [{path: 'news', component: NewsPageComponent}]; @@ -55,7 +55,7 @@ const newsRoutes: Routes = [{path: 'news', component: NewsPageComponent}]; SettingsModule, UtilModule, ParseIsoPipeModule, - FormatRelativeToNowPipeModule, + FormatRelativeToNowPurePipeModule, ], providers: [SettingsProvider], exports: [NewsItemComponent], diff --git a/frontend/app/src/app/modules/profile/page/my-courses.html b/frontend/app/src/app/modules/profile/page/my-courses.html index e811324e..ff19acec 100644 --- a/frontend/app/src/app/modules/profile/page/my-courses.html +++ b/frontend/app/src/app/modules/profile/page/my-courses.html @@ -20,8 +20,8 @@ {{myCourse.startTime | dfnsParseIso | dfnsFormat: 'p'}} - {{myCourse.endTime | dfnsParseIso | - dfnsFormat: 'p'}}{{myCourse.startTime | dfnsParseIso | dfnsFormatPure: 'p'}} - {{myCourse.endTime | dfnsParseIso | + dfnsFormatPure: 'p'}}
- {{ dateRange.startDate | dfnsFormat : 'P' }} - {{ dateRange.endDate | dfnsFormat : 'P' }} + {{ dateRange.startDate | dfnsFormatPure : 'P' }} - {{ dateRange.endDate | dfnsFormatPure : 'P' }} diff --git a/frontend/app/src/app/modules/schedule/page/grid/schedule-day.html b/frontend/app/src/app/modules/schedule/page/grid/schedule-day.html index c58d0166..7ffb0239 100644 --- a/frontend/app/src/app/modules/schedule/page/grid/schedule-day.html +++ b/frontend/app/src/app/modules/schedule/page/grid/schedule-day.html @@ -13,7 +13,7 @@ ~ this program. If not, see . -->
-
{{ day | dfnsFormat : dateFormat }}
+
{{ day | dfnsFormatPure : dateFormat }}
- {{ day[0].day | dfnsFormat : 'PPP' }} + {{ day[0].day | dfnsFormatPure : 'PPP' }}
{{ event.event.time.startAsString }} diff --git a/frontend/app/src/app/modules/schedule/page/schedule-view.html b/frontend/app/src/app/modules/schedule/page/schedule-view.html index 91b99a03..7c6e9bf3 100644 --- a/frontend/app/src/app/modules/schedule/page/schedule-view.html +++ b/frontend/app/src/app/modules/schedule/page/schedule-view.html @@ -25,7 +25,7 @@
-
+
{{ i + hoursRange.from }}
diff --git a/frontend/app/src/app/modules/schedule/schedule.module.ts b/frontend/app/src/app/modules/schedule/schedule.module.ts index e5812292..62d85122 100644 --- a/frontend/app/src/app/modules/schedule/schedule.module.ts +++ b/frontend/app/src/app/modules/schedule/schedule.module.ts @@ -35,7 +35,7 @@ import {InfiniteSwiperComponent} from './page/grid/infinite-swiper.component'; import {CalendarComponent} from './page/components/calendar.component'; import {IonIconModule} from '../../util/ion-icon/ion-icon.module'; import {ChooseEventsPageComponent} from './page/choose-events-page.component'; -import {AddDaysPipeModule, DateFnsModule, FormatPipeModule, IsSameDayPipeModule} from 'ngx-date-fns'; +import {AddDaysPipeModule, FormatPurePipeModule, IsSameDayPipeModule, IsTodayPipeModule} from 'ngx-date-fns'; const settingsRoutes: Routes = [ {path: 'schedule', redirectTo: 'schedule/calendar/now'}, @@ -76,9 +76,9 @@ const settingsRoutes: Routes = [ UtilModule, ThingTranslateModule, AddDaysPipeModule, - FormatPipeModule, IsSameDayPipeModule, - DateFnsModule, + FormatPurePipeModule, + IsTodayPipeModule, ], providers: [ScheduleProvider, DataProvider], }) diff --git a/frontend/app/src/app/translation/dfns-locale.ts b/frontend/app/src/app/translation/dfns-locale.ts index 28ed9a49..c362c1cf 100644 --- a/frontend/app/src/app/translation/dfns-locale.ts +++ b/frontend/app/src/app/translation/dfns-locale.ts @@ -15,6 +15,7 @@ import {SCLanguageCode} from '@openstapps/core'; import type {Locale} from 'date-fns'; import {TranslateService} from '@ngx-translate/core'; +import {firstValueFrom} from 'rxjs'; export interface LocaleExtension extends Locale { formatFrequencyOptions: Partial>; @@ -46,9 +47,8 @@ export async function getDateFnsLocale( console.warn(`Unknown Locale "${code}" for Date Fns. Falling back to English.`); } const key = code in LOCALES ? (code as keyof typeof LOCALES) : 'en'; - const translations = translator.translations[translator.currentLang]; - const frequencyExtension = translations['dateFns']['FORMAT_FREQUENCY']; - const relativeDateExtension = translations['dateFns']['FORMAT_RELATIVE_DATE']; + const frequencyExtension = await firstValueFrom(translator.get('dateFns.FORMAT_FREQUENCY')); + const relativeDateExtension = await firstValueFrom(translator.get('dateFns.FORMAT_RELATIVE_DATE')); return LOCALES[key]().then(it => { const locale = it.default as LocaleExtension; diff --git a/frontend/app/src/app/translation/property-name-translate.pipe.ts b/frontend/app/src/app/translation/property-name-translate.pipe.ts index 4b30b33e..9c55c6b3 100644 --- a/frontend/app/src/app/translation/property-name-translate.pipe.ts +++ b/frontend/app/src/app/translation/property-name-translate.pipe.ts @@ -41,9 +41,9 @@ export class PropertyNameTranslatePipe implements PipeTransform, OnDestroy { this.value = this.thingTranslate.getPropertyName(type as SCThingType, key); } - transform(query: unknown, thingOrType: SCThings | string | unknown): unknown { + transform(query: unknown, thingOrType: SCThings | string | unknown): string { if (typeof query !== 'string' || query.length <= 0) { - return query; + return query as string; } if (!isThing(thingOrType) && typeof thingOrType !== 'string') { @@ -70,7 +70,7 @@ export class PropertyNameTranslatePipe implements PipeTransform, OnDestroy { }); } - return this.value; + return this.value as string; } /** diff --git a/frontend/app/src/app/util/opening-hours.html b/frontend/app/src/app/util/opening-hours.html index 8ac3b7ce..e10e08c9 100644 --- a/frontend/app/src/app/util/opening-hours.html +++ b/frontend/app/src/app/util/opening-hours.html @@ -22,11 +22,11 @@ {{ ('common.openingHours.' + openingHours.nextChangeAction + '_soon') | translate: {duration: - (openingHours.nextChangeSoon | async | dfnsFormatDistanceToNowStrict: {unit: 'minute'})} }} + (openingHours.nextChangeSoon | async | dfnsFormatDistanceToNowStrictPure: {unit: 'minute'})} }} {{ ('common.openingHours.' + openingHours.nextChangeAction) | translate: {date: openingHours.nextChange - | dfnsFormatRelativeToNow} }} + | dfnsFormatRelativeToNowPure} }}
diff --git a/frontend/app/src/app/util/util.module.ts b/frontend/app/src/app/util/util.module.ts index 9d5c5692..61b61f9d 100644 --- a/frontend/app/src/app/util/util.module.ts +++ b/frontend/app/src/app/util/util.module.ts @@ -27,7 +27,7 @@ import {SearchbarAutofocusDirective} from './searchbar-autofocus.directive'; import {SectionComponent} from './section.component'; import {RouterModule} from '@angular/router'; import {IonContentParallaxDirective} from './ion-content-parallax.directive'; -import {FormatDistanceToNowStrictPipeModule, FormatRelativeToNowPipeModule} from 'ngx-date-fns'; +import {FormatDistanceToNowStrictPurePipeModule, FormatRelativeToNowPurePipeModule} from 'ngx-date-fns'; @NgModule({ imports: [ @@ -36,8 +36,8 @@ import {FormatDistanceToNowStrictPipeModule, FormatRelativeToNowPipeModule} from TranslateModule, ThingTranslateModule.forChild(), RouterModule, - FormatRelativeToNowPipeModule, - FormatDistanceToNowStrictPipeModule, + FormatRelativeToNowPurePipeModule, + FormatDistanceToNowStrictPurePipeModule, ], declarations: [ IonContentParallaxDirective, diff --git a/frontend/app/src/assets/i18n/de.json b/frontend/app/src/assets/i18n/de.json index 74efa6e3..f1149016 100644 --- a/frontend/app/src/assets/i18n/de.json +++ b/frontend/app/src/assets/i18n/de.json @@ -18,7 +18,7 @@ "yesterday": "'gestern'", "today": "'heute'", "tomorrow": "'morgen'", - "nextWeek": "'nächsten' eeee", + "nextWeek": "eeee", "other": "pp" } }, diff --git a/frontend/app/src/assets/i18n/en.json b/frontend/app/src/assets/i18n/en.json index b8c950a3..8a0daa46 100644 --- a/frontend/app/src/assets/i18n/en.json +++ b/frontend/app/src/assets/i18n/en.json @@ -18,7 +18,7 @@ "yesterday": "'yesterday'", "today": "'today'", "tomorrow": "'tomorrow'", - "nextWeek": "'next' eeee", + "nextWeek": "eeee", "other": "pp" } },