diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts
index 60fafff5a..21beebbe8 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts
@@ -1,7 +1,8 @@
-import { DatePipe, NgFor, NgIf } from '@angular/common'
+import { NgFor, NgIf } from '@angular/common'
import { Component, Input, OnChanges } from '@angular/core'
import { RouterLink } from '@angular/router'
import { HooksService } from '@app/core'
+import { PTDatePipe } from '@app/shared/shared-main/common/date.pipe'
import { TimeDurationFormatterPipe } from '@app/shared/shared-main/date/time-duration-formatter.pipe'
import { VideoDetails } from '@app/shared/shared-main/video/video-details.model'
import { GlobalIconComponent } from '../../../../shared/shared-icons/global-icon.component'
@@ -18,7 +19,7 @@ type PluginMetadata = {
templateUrl: './video-attributes.component.html',
styleUrls: [ './video-attributes.component.scss' ],
standalone: true,
- imports: [ NgIf, RouterLink, GlobalIconComponent, NgFor, DatePipe, TimeDurationFormatterPipe ]
+ imports: [ NgIf, RouterLink, GlobalIconComponent, NgFor, TimeDurationFormatterPipe, PTDatePipe ]
})
export class VideoAttributesComponent implements OnChanges {
@Input() video: VideoDetails
diff --git a/client/src/app/shared/shared-abuse-list/abuse-details.component.html b/client/src/app/shared/shared-abuse-list/abuse-details.component.html
index a53cbd027..b456aeed9 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-details.component.html
+++ b/client/src/app/shared/shared-abuse-list/abuse-details.component.html
@@ -44,7 +44,7 @@
Updated
-
+
diff --git a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts
index c34655504..fb3c45a1a 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts
+++ b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts
@@ -1,19 +1,20 @@
+import { NgFor, NgIf } from '@angular/common'
import { Component, Input, OnInit } from '@angular/core'
+import { RouterLink } from '@angular/router'
import { durationToString } from '@app/helpers'
import { AbusePredefinedReasonsString } from '@peertube/peertube-models'
-import { ProcessedAbuse } from './processed-abuse.model'
-import { EmbedComponent } from '../shared-main/video/embed.component'
-import { GlobalIconComponent } from '../shared-icons/global-icon.component'
import { ActorAvatarComponent } from '../shared-actor-image/actor-avatar.component'
-import { RouterLink } from '@angular/router'
-import { NgIf, NgFor, DatePipe } from '@angular/common'
+import { GlobalIconComponent } from '../shared-icons/global-icon.component'
+import { PTDatePipe } from '../shared-main/common/date.pipe'
+import { EmbedComponent } from '../shared-main/video/embed.component'
+import { ProcessedAbuse } from './processed-abuse.model'
@Component({
selector: 'my-abuse-details',
templateUrl: './abuse-details.component.html',
styleUrls: [ '../shared-moderation/moderation.scss', './abuse-details.component.scss' ],
standalone: true,
- imports: [ NgIf, RouterLink, ActorAvatarComponent, GlobalIconComponent, NgFor, EmbedComponent, DatePipe ]
+ imports: [ NgIf, RouterLink, ActorAvatarComponent, GlobalIconComponent, NgFor, EmbedComponent, PTDatePipe ]
})
export class AbuseDetailsComponent implements OnInit {
@Input() abuse: ProcessedAbuse
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html
index 32fdda023..19fb26a31 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html
+++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html
@@ -118,7 +118,7 @@
-
{{ abuse.createdAt | date: 'short' }} |
+
{{ abuse.createdAt | ptDate: 'short' }} |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
index a348eabe7..0151bc4cc 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
+++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
@@ -1,33 +1,34 @@
-import debug from 'debug'
-import { SortMeta, SharedModule } from 'primeng/api'
+import { NgClass, NgIf } from '@angular/common'
import { Component, Input, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core'
+import { formatICU } from '@app/helpers'
+import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'
import { AbuseState, AbuseStateType, AdminAbuse } from '@peertube/peertube-models'
import { logger } from '@root-helpers/logger'
-import { AbuseMessageModalComponent } from './abuse-message-modal.component'
-import { ModerationCommentModalComponent } from './moderation-comment-modal.component'
-import { ProcessedAbuse } from './processed-abuse.model'
-import { AbuseDetailsComponent } from './abuse-details.component'
-import { AutoColspanDirective } from '../shared-main/common/auto-colspan.directive'
-import { GlobalIconComponent } from '../shared-icons/global-icon.component'
-import { VideoCellComponent } from '../shared-tables/video-cell.component'
-import { ActorAvatarComponent } from '../shared-actor-image/actor-avatar.component'
-import { ActionDropdownComponent, DropdownAction } from '../shared-main/buttons/action-dropdown.component'
-import { TableExpanderIconComponent } from '../shared-tables/table-expander-icon.component'
-import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'
-import { NgIf, NgClass, DatePipe } from '@angular/common'
-import { AdvancedInputFilter, AdvancedInputFilterComponent } from '../shared-forms/advanced-input-filter.component'
+import debug from 'debug'
+import { SharedModule, SortMeta } from 'primeng/api'
import { TableModule } from 'primeng/table'
-import { Video } from '../shared-main/video/video.model'
-import { Actor } from '../shared-main/account/actor.model'
-import { VideoService } from '../shared-main/video/video.service'
+import { ActorAvatarComponent } from '../shared-actor-image/actor-avatar.component'
+import { AdvancedInputFilter, AdvancedInputFilterComponent } from '../shared-forms/advanced-input-filter.component'
+import { GlobalIconComponent } from '../shared-icons/global-icon.component'
import { Account } from '../shared-main/account/account.model'
+import { Actor } from '../shared-main/account/actor.model'
+import { ActionDropdownComponent, DropdownAction } from '../shared-main/buttons/action-dropdown.component'
+import { AutoColspanDirective } from '../shared-main/common/auto-colspan.directive'
+import { PTDatePipe } from '../shared-main/common/date.pipe'
+import { Video } from '../shared-main/video/video.model'
+import { VideoService } from '../shared-main/video/video.service'
import { AbuseService } from '../shared-moderation/abuse.service'
import { BlocklistService } from '../shared-moderation/blocklist.service'
import { VideoBlockService } from '../shared-moderation/video-block.service'
+import { TableExpanderIconComponent } from '../shared-tables/table-expander-icon.component'
+import { VideoCellComponent } from '../shared-tables/video-cell.component'
import { VideoCommentService } from '../shared-video-comment/video-comment.service'
-import { formatICU } from '@app/helpers'
+import { AbuseDetailsComponent } from './abuse-details.component'
+import { AbuseMessageModalComponent } from './abuse-message-modal.component'
+import { ModerationCommentModalComponent } from './moderation-comment-modal.component'
+import { ProcessedAbuse } from './processed-abuse.model'
const debugLogger = debug('peertube:moderation:AbuseListTableComponent')
@@ -52,7 +53,7 @@ const debugLogger = debug('peertube:moderation:AbuseListTableComponent')
AbuseDetailsComponent,
ModerationCommentModalComponent,
AbuseMessageModalComponent,
- DatePipe
+ PTDatePipe
]
})
export class AbuseListTableComponent extends RestTable implements OnInit {
diff --git a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.html b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.html
index ce973efd9..224db1ed9 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.html
+++ b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.html
@@ -21,7 +21,7 @@
- {{ message.createdAt | date }}
+ {{ message.createdAt | ptDate }}
diff --git a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts
index 05a58c89f..03bd26df0 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts
+++ b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts
@@ -1,15 +1,16 @@
+import { NgClass, NgFor, NgIf } from '@angular/common'
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
+import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { AuthService, HtmlRendererService, Notifier } from '@app/core'
import { FormReactive } from '@app/shared/shared-forms/form-reactive'
import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { logger } from '@root-helpers/logger'
import { AbuseMessage, UserAbuse } from '@peertube/peertube-models'
+import { logger } from '@root-helpers/logger'
import { ABUSE_MESSAGE_VALIDATOR } from '../form-validators/abuse-validators'
-import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { GlobalIconComponent } from '../shared-icons/global-icon.component'
-import { NgIf, NgFor, NgClass, DatePipe } from '@angular/common'
+import { PTDatePipe } from '../shared-main/common/date.pipe'
import { AbuseService } from '../shared-moderation/abuse.service'
@Component({
@@ -17,7 +18,7 @@ import { AbuseService } from '../shared-moderation/abuse.service'
templateUrl: './abuse-message-modal.component.html',
styleUrls: [ './abuse-message-modal.component.scss' ],
standalone: true,
- imports: [ NgIf, GlobalIconComponent, NgFor, NgClass, FormsModule, ReactiveFormsModule, DatePipe ]
+ imports: [ NgIf, GlobalIconComponent, NgFor, NgClass, FormsModule, ReactiveFormsModule, PTDatePipe ]
})
export class AbuseMessageModalComponent extends FormReactive implements OnInit {
@ViewChild('modal', { static: true }) modal: NgbModal
diff --git a/client/src/app/shared/shared-main/common/date.pipe.ts b/client/src/app/shared/shared-main/common/date.pipe.ts
new file mode 100644
index 000000000..da89d59f7
--- /dev/null
+++ b/client/src/app/shared/shared-main/common/date.pipe.ts
@@ -0,0 +1,31 @@
+import { DatePipe } from '@angular/common'
+import { Inject, LOCALE_ID, Pipe, PipeTransform } from '@angular/core'
+
+// Re-implementation of the angular date pipe that use the web browser locale to display dates
+
+@Pipe({
+ name: 'ptDate',
+ standalone: true,
+ pure: true
+})
+export class PTDatePipe implements PipeTransform {
+ private angularPipe: DatePipe
+ private customLocaleId: string
+
+ constructor (@Inject(LOCALE_ID) localeId: string) {
+ if (navigator.language.includes('-') && navigator.language.split('-')[0] === localeId.split('-')[0]) {
+ this.customLocaleId = navigator.language
+ } else {
+ this.customLocaleId = localeId
+ }
+
+ this.angularPipe = new DatePipe(localeId)
+ }
+
+ transform (value: Date | string | number | null | undefined, format?: string): string {
+ if (format === 'short') return new Date(value).toLocaleString(this.customLocaleId)
+ if (format === 'shortDate') return new Date(value).toLocaleDateString(this.customLocaleId)
+
+ return this.angularPipe.transform(value, format)
+ }
+}
diff --git a/client/src/app/shared/shared-moderation/account-blocklist.component.html b/client/src/app/shared/shared-moderation/account-blocklist.component.html
index 33ac003b2..6739607de 100644
--- a/client/src/app/shared/shared-moderation/account-blocklist.component.html
+++ b/client/src/app/shared/shared-moderation/account-blocklist.component.html
@@ -37,7 +37,7 @@
|
-
{{ accountBlock.createdAt | date: 'short' }} |
+
{{ accountBlock.createdAt | ptDate: 'short' }} |
diff --git a/client/src/app/shared/shared-moderation/server-blocklist.component.html b/client/src/app/shared/shared-moderation/server-blocklist.component.html
index c8ab868c8..5f92bff04 100644
--- a/client/src/app/shared/shared-moderation/server-blocklist.component.html
+++ b/client/src/app/shared/shared-moderation/server-blocklist.component.html
@@ -39,7 +39,7 @@
-
{{ serverBlock.createdAt | date: 'short' }} |
+
{{ serverBlock.createdAt | ptDate: 'short' }} |
diff --git a/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.html b/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.html
index e28c85887..5cb016d84 100644
--- a/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.html
+++ b/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.html
@@ -96,7 +96,7 @@
}
-
{{ videoComment.createdAt | date: 'short' }} |
+
{{ videoComment.createdAt | ptDate: 'short' }} |
diff --git a/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.ts b/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.ts
index 8dff7ea9f..70133962b 100644
--- a/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.ts
+++ b/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.ts
@@ -1,4 +1,4 @@
-import { DatePipe, NgClass, NgIf } from '@angular/common'
+import { NgClass, NgIf } from '@angular/common'
import { Component, Input, OnInit } from '@angular/core'
import { ActivatedRoute, Router, RouterLink } from '@angular/router'
import { AuthService, ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core'
@@ -12,11 +12,10 @@ import { SharedModule, SortMeta } from 'primeng/api'
import { TableModule } from 'primeng/table'
import { ActorAvatarComponent } from '../shared-actor-image/actor-avatar.component'
import { AdvancedInputFilter, AdvancedInputFilterComponent } from '../shared-forms/advanced-input-filter.component'
-import { GlobalIconComponent } from '../shared-icons/global-icon.component'
-import { AutoColspanDirective } from '../shared-main/common/auto-colspan.directive'
import { ActionDropdownComponent, DropdownAction } from '../shared-main/buttons/action-dropdown.component'
import { ButtonComponent } from '../shared-main/buttons/button.component'
-import { FeedComponent } from '../shared-main/feeds/feed.component'
+import { AutoColspanDirective } from '../shared-main/common/auto-colspan.directive'
+import { PTDatePipe } from '../shared-main/common/date.pipe'
import { TableExpanderIconComponent } from '../shared-tables/table-expander-icon.component'
@Component({
@@ -25,8 +24,6 @@ import { TableExpanderIconComponent } from '../shared-tables/table-expander-icon
styleUrls: [ '../shared-moderation/moderation.scss', './video-comment-list-admin-owner.component.scss' ],
standalone: true,
imports: [
- GlobalIconComponent,
- FeedComponent,
TableModule,
SharedModule,
NgIf,
@@ -38,7 +35,7 @@ import { TableExpanderIconComponent } from '../shared-tables/table-expander-icon
NgClass,
ActorAvatarComponent,
AutoColspanDirective,
- DatePipe,
+ PTDatePipe,
RouterLink
]
})
diff --git a/client/src/app/shared/shared-video-live/live-stream-information.component.html b/client/src/app/shared/shared-video-live/live-stream-information.component.html
index 7be81e8d0..ece5d58b6 100644
--- a/client/src/app/shared/shared-video-live/live-stream-information.component.html
+++ b/client/src/app/shared/shared-video-live/live-stream-information.component.html
@@ -41,8 +41,8 @@
Success
{{ getErrorLabel(session) }}
-
Started on {{ session.startDate | date:'medium' }}
-
Ended on {{ session.endDate | date:'medium' }}
+
Started on {{ session.startDate | ptDate:'medium' }}
+
Ended on {{ session.endDate | ptDate:'medium' }}
Go to replay
Replay is being processed...
diff --git a/client/src/app/shared/shared-video-live/live-stream-information.component.ts b/client/src/app/shared/shared-video-live/live-stream-information.component.ts
index 77cdd6ba4..baf390f4c 100644
--- a/client/src/app/shared/shared-video-live/live-stream-information.component.ts
+++ b/client/src/app/shared/shared-video-live/live-stream-information.component.ts
@@ -1,4 +1,4 @@
-import { DatePipe, NgFor, NgIf } from '@angular/common'
+import { NgFor, NgIf } from '@angular/common'
import { Component, ElementRef, ViewChild } from '@angular/core'
import { RouterLink } from '@angular/router'
import { Video } from '@app/shared/shared-main/video/video.model'
@@ -8,6 +8,7 @@ import { InputTextComponent } from '../shared-forms/input-text.component'
import { GlobalIconComponent } from '../shared-icons/global-icon.component'
import { EditButtonComponent } from '../shared-main/buttons/edit-button.component'
import { AlertComponent } from '../shared-main/common/alert.component'
+import { PTDatePipe } from '../shared-main/common/date.pipe'
import { LiveDocumentationLinkComponent } from './live-documentation-link.component'
import { LiveVideoService } from './live-video.service'
@@ -24,7 +25,7 @@ import { LiveVideoService } from './live-video.service'
NgFor,
RouterLink,
EditButtonComponent,
- DatePipe,
+ PTDatePipe,
AlertComponent
],
providers: [ LiveVideoService ]
diff --git a/client/src/app/shared/standalone-watched-words/watched-words-list-admin-owner.component.html b/client/src/app/shared/standalone-watched-words/watched-words-list-admin-owner.component.html
index 46088d3db..c84ba094a 100644
--- a/client/src/app/shared/standalone-watched-words/watched-words-list-admin-owner.component.html
+++ b/client/src/app/shared/standalone-watched-words/watched-words-list-admin-owner.component.html
@@ -56,7 +56,7 @@
{{ list.words.length }} words
-