Skip to content
This repository was archived by the owner on Oct 31, 2022. It is now read-only.

Commit 8d71a48

Browse files
authored
FE-276-autocommit (#133)
FE-276-unable-type-date-fix
1 parent 9047ff2 commit 8d71a48

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [Unreleased]
44

5+
## 0.23.5
6+
7+
### Fixed
8+
9+
- Pipe app date fixed due to an invalid format in Safari Browser ([#133](https://github.com/reyesoft/ngx-jsonapi-material/pull/133))
10+
511
## 0.23.4
612

713
### Fixed

Diff for: projects/ngx-jsonapi-material/src/lib/list-base/date-pipe/app-date.pipe.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import { Pipe, PipeTransform } from '@angular/core';
22
import { DatePipe } from '@angular/common';
33

44
@Pipe({
5-
name: 'appdate'
5+
name: 'appdate',
6+
pure: true
67
})
78
export class AppDatePipe extends DatePipe implements PipeTransform {
89
public transform(value: any): any {
9-
return super.transform(value, 'dd/MM/yyyy');
10+
return super.transform(new Date(value).toISOString(), 'dd/MM/yyyy');
1011
}
1112
}
1213

@@ -15,6 +16,6 @@ export class AppDatePipe extends DatePipe implements PipeTransform {
1516
})
1617
export class AppDateTimePipe extends DatePipe implements PipeTransform {
1718
public transform(value: any): any {
18-
return super.transform(value, 'dd/MM/yyyy HH:mm:ss');
19+
return super.transform(new Date(value).toISOString(), 'dd/MM/yyyy HH:mm:ss');
1920
}
2021
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { DatePipe } from "@angular/common";
2+
import { AppDatePipe, AppDateTimePipe } from "./app-date.pipe";
3+
4+
describe('AppDatePipe', (): void => {
5+
const pipe: DatePipe = new AppDatePipe('en-US');
6+
const pipeWithTime: DatePipe = new AppDateTimePipe('en-US')
7+
8+
it('Should transforms 2021-06-11 16:00:00 to 11/06/2021', (): void => {
9+
expect(pipe.transform('2021-06-11 16:00:00')).toBe('11/06/2021');
10+
});
11+
12+
it('Should transforms 2021-06-11 16:00:00 to 11/06/2021 16:00:00', (): void => {
13+
expect(pipeWithTime.transform('2021-06-11 16:00:00')).toBe('11/06/2021 16:00:00');
14+
});
15+
16+
});

0 commit comments

Comments
 (0)