ngx-st-date-format 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/pipes/date-format.pipe.mjs +10 -6
- package/esm2020/lib/pipes/date-time-format.pipe.mjs +12 -2
- package/esm2020/lib/pipes/time-format.pipe.mjs +18 -2
- package/fesm2015/ngx-st-date-format.mjs +37 -7
- package/fesm2015/ngx-st-date-format.mjs.map +1 -1
- package/fesm2020/ngx-st-date-format.mjs +37 -7
- package/fesm2020/ngx-st-date-format.mjs.map +1 -1
- package/lib/pipes/date-time-format.pipe.d.ts +1 -1
- package/lib/pipes/time-format.pipe.d.ts +1 -1
- package/package.json +3 -2
|
@@ -2,13 +2,17 @@ import { Pipe } from '@angular/core';
|
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export class DateFormatPipe {
|
|
4
4
|
transform(value) {
|
|
5
|
-
if (value
|
|
6
|
-
|
|
5
|
+
if (value) {
|
|
6
|
+
if (value instanceof Date) {
|
|
7
|
+
return value.toLocaleDateString();
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return new Date(value).toLocaleDateString();
|
|
11
|
+
}
|
|
7
12
|
}
|
|
8
|
-
else
|
|
9
|
-
return
|
|
13
|
+
else {
|
|
14
|
+
return '';
|
|
10
15
|
}
|
|
11
|
-
return '';
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
DateFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -19,4 +23,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
19
23
|
name: 'stDateFormatPipe',
|
|
20
24
|
}]
|
|
21
25
|
}] });
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL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clxuICAgICAgaWYgKHZhbHVlIGluc3RhbmNlb2YgRGF0ZSkge1xyXG4gICAgICAgIHJldHVybiB2YWx1ZS50b0xvY2FsZURhdGVTdHJpbmcoKTtcclxuICAgICAgfSBlbHNlIHtcclxuICAgICAgICByZXR1cm4gbmV3IERhdGUodmFsdWUpLnRvTG9jYWxlRGF0ZVN0cmluZygpO1xyXG4gICAgICB9XHJcbiAgICB9IGVsc2Uge1xyXG4gICAgICByZXR1cm4gJyc7XHJcbiAgICB9XHJcbiAgfVxyXG59XHJcbiJdfQ==
|
|
@@ -2,7 +2,17 @@ import { Pipe } from '@angular/core';
|
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export class DateTimeFormatPipe {
|
|
4
4
|
transform(value) {
|
|
5
|
-
|
|
5
|
+
if (value) {
|
|
6
|
+
if (value instanceof Date) {
|
|
7
|
+
return value.toLocaleString();
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return new Date(value).toLocaleString();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
6
16
|
}
|
|
7
17
|
}
|
|
8
18
|
DateTimeFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateTimeFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -13,4 +23,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
13
23
|
name: 'stDateTimeFormatPipe',
|
|
14
24
|
}]
|
|
15
25
|
}] });
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZS10aW1lLWZvcm1hdC5waXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjd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G4gICAgICB9IGVsc2Uge1xyXG4gICAgICAgIHJldHVybiBuZXcgRGF0ZSh2YWx1ZSkudG9Mb2NhbGVTdHJpbmcoKTtcclxuICAgICAgfVxyXG4gICAgfSBlbHNlIHtcclxuICAgICAgcmV0dXJuICcnO1xyXG4gICAgfVxyXG4gIH1cclxufVxyXG4iXX0=
|
|
@@ -2,7 +2,23 @@ import { Pipe } from '@angular/core';
|
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export class TimeFormatPipe {
|
|
4
4
|
transform(value) {
|
|
5
|
-
|
|
5
|
+
if (value) {
|
|
6
|
+
if (value instanceof Date) {
|
|
7
|
+
return value.toLocaleTimeString([], {
|
|
8
|
+
hour: '2-digit',
|
|
9
|
+
minute: '2-digit',
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return new Date(value).toLocaleTimeString([], {
|
|
14
|
+
hour: '2-digit',
|
|
15
|
+
minute: '2-digit',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
6
22
|
}
|
|
7
23
|
}
|
|
8
24
|
TimeFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TimeFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -13,4 +29,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
13
29
|
name: 'stTimeFormatPipe',
|
|
14
30
|
}]
|
|
15
31
|
}] });
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGltZS1mb3JtYXQucGlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1z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BEYXRlKSB7XHJcbiAgICBpZiAodmFsdWUpIHtcclxuICAgICAgaWYgKHZhbHVlIGluc3RhbmNlb2YgRGF0ZSkge1xyXG4gICAgICAgIHJldHVybiB2YWx1ZS50b0xvY2FsZVRpbWVTdHJpbmcoW10sIHtcclxuICAgICAgICAgIGhvdXI6ICcyLWRpZ2l0JyxcclxuICAgICAgICAgIG1pbnV0ZTogJzItZGlnaXQnLFxyXG4gICAgICAgIH0pO1xyXG4gICAgICB9IGVsc2Uge1xyXG4gICAgICAgIHJldHVybiBuZXcgRGF0ZSh2YWx1ZSkudG9Mb2NhbGVUaW1lU3RyaW5nKFtdLCB7XHJcbiAgICAgICAgICBob3VyOiAnMi1kaWdpdCcsXHJcbiAgICAgICAgICBtaW51dGU6ICcyLWRpZ2l0JyxcclxuICAgICAgICB9KTtcclxuICAgICAgfVxyXG4gICAgfSBlbHNlIHtcclxuICAgICAgcmV0dXJuICcnO1xyXG4gICAgfVxyXG4gIH1cclxufVxyXG4iXX0=
|
|
@@ -3,13 +3,17 @@ import { Pipe, NgModule } from '@angular/core';
|
|
|
3
3
|
|
|
4
4
|
class DateFormatPipe {
|
|
5
5
|
transform(value) {
|
|
6
|
-
if (value
|
|
7
|
-
|
|
6
|
+
if (value) {
|
|
7
|
+
if (value instanceof Date) {
|
|
8
|
+
return value.toLocaleDateString();
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return new Date(value).toLocaleDateString();
|
|
12
|
+
}
|
|
8
13
|
}
|
|
9
|
-
else
|
|
10
|
-
return
|
|
14
|
+
else {
|
|
15
|
+
return '';
|
|
11
16
|
}
|
|
12
|
-
return '';
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
DateFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -23,7 +27,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
23
27
|
|
|
24
28
|
class DateTimeFormatPipe {
|
|
25
29
|
transform(value) {
|
|
26
|
-
|
|
30
|
+
if (value) {
|
|
31
|
+
if (value instanceof Date) {
|
|
32
|
+
return value.toLocaleString();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return new Date(value).toLocaleString();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
27
41
|
}
|
|
28
42
|
}
|
|
29
43
|
DateTimeFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateTimeFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -37,7 +51,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
37
51
|
|
|
38
52
|
class TimeFormatPipe {
|
|
39
53
|
transform(value) {
|
|
40
|
-
|
|
54
|
+
if (value) {
|
|
55
|
+
if (value instanceof Date) {
|
|
56
|
+
return value.toLocaleTimeString([], {
|
|
57
|
+
hour: '2-digit',
|
|
58
|
+
minute: '2-digit',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return new Date(value).toLocaleTimeString([], {
|
|
63
|
+
hour: '2-digit',
|
|
64
|
+
minute: '2-digit',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
41
71
|
}
|
|
42
72
|
}
|
|
43
73
|
TimeFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TimeFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-st-date-format.mjs","sources":["../../../projects/ngx-st-date-format/src/lib/pipes/date-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/pipes/date-time-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/pipes/time-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/st-date-format.module.ts","../../../projects/ngx-st-date-format/src/public-api.ts","../../../projects/ngx-st-date-format/src/ngx-st-date-format.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n
|
|
1
|
+
{"version":3,"file":"ngx-st-date-format.mjs","sources":["../../../projects/ngx-st-date-format/src/lib/pipes/date-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/pipes/date-time-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/pipes/time-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/st-date-format.module.ts","../../../projects/ngx-st-date-format/src/public-api.ts","../../../projects/ngx-st-date-format/src/ngx-st-date-format.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'stDateFormatPipe',\r\n})\r\nexport class DateFormatPipe implements PipeTransform {\r\n transform(value: string | Date) {\r\n if (value) {\r\n if (value instanceof Date) {\r\n return value.toLocaleDateString();\r\n } else {\r\n return new Date(value).toLocaleDateString();\r\n }\r\n } else {\r\n return '';\r\n }\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'stDateTimeFormatPipe',\r\n})\r\nexport class DateTimeFormatPipe implements PipeTransform {\r\n transform(value: string | Date) {\r\n if (value) {\r\n if (value instanceof Date) {\r\n return value.toLocaleString();\r\n } else {\r\n return new Date(value).toLocaleString();\r\n }\r\n } else {\r\n return '';\r\n }\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'stTimeFormatPipe',\r\n})\r\nexport class TimeFormatPipe implements PipeTransform {\r\n transform(value: string | Date) {\r\n if (value) {\r\n if (value instanceof Date) {\r\n return value.toLocaleTimeString([], {\r\n hour: '2-digit',\r\n minute: '2-digit',\r\n });\r\n } else {\r\n return new Date(value).toLocaleTimeString([], {\r\n hour: '2-digit',\r\n minute: '2-digit',\r\n });\r\n }\r\n } else {\r\n return '';\r\n }\r\n }\r\n}\r\n","import {NgModule} from \"@angular/core\";\r\nimport {DateFormatPipe} from \"./pipes/date-format.pipe\";\r\nimport {DateTimeFormatPipe} from \"./pipes/date-time-format.pipe\";\r\nimport {TimeFormatPipe} from \"./pipes/time-format.pipe\";\r\n\r\n@NgModule({\r\n imports: [],\r\n declarations: [\r\n DateFormatPipe,\r\n DateTimeFormatPipe,\r\n TimeFormatPipe\r\n ],\r\n exports: [\r\n DateFormatPipe,\r\n DateTimeFormatPipe,\r\n TimeFormatPipe\r\n ],\r\n providers: []\r\n})\r\nexport class StDateFormatModule {\r\n\r\n}\r\n","/*\r\n * Public API Surface of ngx-st-date-format\r\n */\r\n\r\nexport * from './lib/pipes/date-format.pipe';\r\nexport * from './lib/pipes/date-time-format.pipe';\r\nexport * from './lib/pipes/time-format.pipe';\r\nexport * from './lib/st-date-format.module';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAKa,cAAc,CAAA;AACzB,IAAA,SAAS,CAAC,KAAoB,EAAA;AAC5B,QAAA,IAAI,KAAK,EAAE;YACT,IAAI,KAAK,YAAY,IAAI,EAAE;AACzB,gBAAA,OAAO,KAAK,CAAC,kBAAkB,EAAE,CAAC;AACnC,aAAA;AAAM,iBAAA;gBACL,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,kBAAkB,EAAE,CAAC;AAC7C,aAAA;AACF,SAAA;AAAM,aAAA;AACL,YAAA,OAAO,EAAE,CAAC;AACX,SAAA;KACF;;2GAXU,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;yGAAd,cAAc,EAAA,IAAA,E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|
|
|
3
3
|
|
|
4
4
|
class DateFormatPipe {
|
|
5
5
|
transform(value) {
|
|
6
|
-
if (value
|
|
7
|
-
|
|
6
|
+
if (value) {
|
|
7
|
+
if (value instanceof Date) {
|
|
8
|
+
return value.toLocaleDateString();
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return new Date(value).toLocaleDateString();
|
|
12
|
+
}
|
|
8
13
|
}
|
|
9
|
-
else
|
|
10
|
-
return
|
|
14
|
+
else {
|
|
15
|
+
return '';
|
|
11
16
|
}
|
|
12
|
-
return '';
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
DateFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -23,7 +27,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
23
27
|
|
|
24
28
|
class DateTimeFormatPipe {
|
|
25
29
|
transform(value) {
|
|
26
|
-
|
|
30
|
+
if (value) {
|
|
31
|
+
if (value instanceof Date) {
|
|
32
|
+
return value.toLocaleString();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return new Date(value).toLocaleString();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
27
41
|
}
|
|
28
42
|
}
|
|
29
43
|
DateTimeFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateTimeFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -37,7 +51,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
37
51
|
|
|
38
52
|
class TimeFormatPipe {
|
|
39
53
|
transform(value) {
|
|
40
|
-
|
|
54
|
+
if (value) {
|
|
55
|
+
if (value instanceof Date) {
|
|
56
|
+
return value.toLocaleTimeString([], {
|
|
57
|
+
hour: '2-digit',
|
|
58
|
+
minute: '2-digit',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return new Date(value).toLocaleTimeString([], {
|
|
63
|
+
hour: '2-digit',
|
|
64
|
+
minute: '2-digit',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
41
71
|
}
|
|
42
72
|
}
|
|
43
73
|
TimeFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TimeFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-st-date-format.mjs","sources":["../../../projects/ngx-st-date-format/src/lib/pipes/date-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/pipes/date-time-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/pipes/time-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/st-date-format.module.ts","../../../projects/ngx-st-date-format/src/public-api.ts","../../../projects/ngx-st-date-format/src/ngx-st-date-format.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n
|
|
1
|
+
{"version":3,"file":"ngx-st-date-format.mjs","sources":["../../../projects/ngx-st-date-format/src/lib/pipes/date-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/pipes/date-time-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/pipes/time-format.pipe.ts","../../../projects/ngx-st-date-format/src/lib/st-date-format.module.ts","../../../projects/ngx-st-date-format/src/public-api.ts","../../../projects/ngx-st-date-format/src/ngx-st-date-format.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'stDateFormatPipe',\r\n})\r\nexport class DateFormatPipe implements PipeTransform {\r\n transform(value: string | Date) {\r\n if (value) {\r\n if (value instanceof Date) {\r\n return value.toLocaleDateString();\r\n } else {\r\n return new Date(value).toLocaleDateString();\r\n }\r\n } else {\r\n return '';\r\n }\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'stDateTimeFormatPipe',\r\n})\r\nexport class DateTimeFormatPipe implements PipeTransform {\r\n transform(value: string | Date) {\r\n if (value) {\r\n if (value instanceof Date) {\r\n return value.toLocaleString();\r\n } else {\r\n return new Date(value).toLocaleString();\r\n }\r\n } else {\r\n return '';\r\n }\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'stTimeFormatPipe',\r\n})\r\nexport class TimeFormatPipe implements PipeTransform {\r\n transform(value: string | Date) {\r\n if (value) {\r\n if (value instanceof Date) {\r\n return value.toLocaleTimeString([], {\r\n hour: '2-digit',\r\n minute: '2-digit',\r\n });\r\n } else {\r\n return new Date(value).toLocaleTimeString([], {\r\n hour: '2-digit',\r\n minute: '2-digit',\r\n });\r\n }\r\n } else {\r\n return '';\r\n }\r\n }\r\n}\r\n","import {NgModule} from \"@angular/core\";\r\nimport {DateFormatPipe} from \"./pipes/date-format.pipe\";\r\nimport {DateTimeFormatPipe} from \"./pipes/date-time-format.pipe\";\r\nimport {TimeFormatPipe} from \"./pipes/time-format.pipe\";\r\n\r\n@NgModule({\r\n imports: [],\r\n declarations: [\r\n DateFormatPipe,\r\n DateTimeFormatPipe,\r\n TimeFormatPipe\r\n ],\r\n exports: [\r\n DateFormatPipe,\r\n DateTimeFormatPipe,\r\n TimeFormatPipe\r\n ],\r\n providers: []\r\n})\r\nexport class StDateFormatModule {\r\n\r\n}\r\n","/*\r\n * Public API Surface of ngx-st-date-format\r\n */\r\n\r\nexport * from './lib/pipes/date-format.pipe';\r\nexport * from './lib/pipes/date-time-format.pipe';\r\nexport * from './lib/pipes/time-format.pipe';\r\nexport * from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EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,iBAXvB,cAAc;QACd,kBAAkB;AAClB,QAAA,cAAc,aAGd,cAAc;QACd,kBAAkB;QAClB,cAAc,CAAA,EAAA,CAAA,CAAA;gHAIT,kBAAkB,EAAA,CAAA,CAAA;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAd9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,YAAY,EAAE;wBACV,cAAc;wBACd,kBAAkB;wBAClB,cAAc;AACjB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACL,cAAc;wBACd,kBAAkB;wBAClB,cAAc;AACjB,qBAAA;AACD,oBAAA,SAAS,EAAE,EAAE;AAChB,iBAAA,CAAA;;;AClBD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare class DateTimeFormatPipe implements PipeTransform {
|
|
4
|
-
transform(value: string): string;
|
|
4
|
+
transform(value: string | Date): string;
|
|
5
5
|
static ɵfac: i0.ɵɵFactoryDeclaration<DateTimeFormatPipe, never>;
|
|
6
6
|
static ɵpipe: i0.ɵɵPipeDeclaration<DateTimeFormatPipe, "stDateTimeFormatPipe", false>;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare class TimeFormatPipe implements PipeTransform {
|
|
4
|
-
transform(value: string): string;
|
|
4
|
+
transform(value: string | Date): string;
|
|
5
5
|
static ɵfac: i0.ɵɵFactoryDeclaration<TimeFormatPipe, never>;
|
|
6
6
|
static ɵpipe: i0.ɵɵPipeDeclaration<TimeFormatPipe, "stTimeFormatPipe", false>;
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-st-date-format",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^14.3.0",
|
|
6
|
-
"@angular/core": "^14.3.0"
|
|
6
|
+
"@angular/core": "^14.3.0",
|
|
7
|
+
"ngx-st-qty-input": "1.0.5"
|
|
7
8
|
},
|
|
8
9
|
"dependencies": {
|
|
9
10
|
"tslib": "^2.3.0"
|