feat: Completed migration from moment to luxon
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<mat-card-title>
|
||||
{{item.title}}
|
||||
</mat-card-title>
|
||||
<mat-card-subtitle>{{item.sentDate.format('[Wysłano] dddd DD MMMM YYYYr. o HH:mm')}}</mat-card-subtitle>
|
||||
<mat-card-subtitle>Wysłano {{item.sentDate.toFormat("cccc dd LLLL yyyyr. 'o' HH:mm")}}</mat-card-subtitle>
|
||||
</mat-card-title-group>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MessageComponent } from './message.component';
|
||||
import { AdminCommService } from 'src/app/admin-view/admin-comm.service';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import moment from 'moment';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
describe('MessageComponent', () => {
|
||||
let component: MessageComponent;
|
||||
@@ -26,7 +25,7 @@ describe('MessageComponent', () => {
|
||||
|
||||
fixture = TestBed.createComponent(MessageComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.item = {_id: "test", sentDate: moment(), title: "Test"}
|
||||
component.item = {_id: "test", sentDate: DateTime.now(), title: "Test"}
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { DateTime } from 'luxon';
|
||||
import { AdminCommService } from 'src/app/admin-view/admin-comm.service';
|
||||
|
||||
@Component({
|
||||
@@ -8,7 +9,7 @@ import { AdminCommService } from 'src/app/admin-view/admin-comm.service';
|
||||
standalone: false
|
||||
})
|
||||
export class MessageComponent {
|
||||
@Input() item!: {_id: string, sentDate: moment.Moment, title: string}
|
||||
@Input() item!: {_id: string, sentDate: DateTime, title: string}
|
||||
body?: string
|
||||
rcpts?: {_id: string, uname: string, room?: string, fname?: string, surname?: string}[]
|
||||
loading: boolean = false
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { AdminCommService } from '../../admin-comm.service';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ToolbarService } from '../../toolbar/toolbar.service';
|
||||
import moment from 'moment';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-outbox',
|
||||
@@ -14,7 +14,7 @@ export class OutboxComponent implements OnInit {
|
||||
|
||||
messages!: {
|
||||
_id: string;
|
||||
sentDate: moment.Moment;
|
||||
sentDate: DateTime;
|
||||
title: string;
|
||||
}[]
|
||||
|
||||
@@ -31,12 +31,7 @@ export class OutboxComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.acs.notif.outbox.getSent().subscribe((v) => {
|
||||
this.messages = v.map(i => {
|
||||
return {
|
||||
...i,
|
||||
sentDate: moment(i.sentDate)
|
||||
}
|
||||
})
|
||||
this.messages = v
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user