ngx-st-date-format 17.0.2 → 18.0.1
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/README.md +165 -13
- package/esm2022/lib/ngx-st-date-format.module.mjs +4 -4
- package/esm2022/lib/pipes/date-format.pipe.mjs +3 -3
- package/esm2022/lib/pipes/date-time-format.pipe.mjs +3 -3
- package/esm2022/lib/pipes/time-format.pipe.mjs +3 -3
- package/fesm2022/ngx-st-date-format.mjs +13 -13
- package/fesm2022/ngx-st-date-format.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,24 +1,176 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Date Format Pipes - Complete Documentation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Table of Contents
|
|
4
|
+
- [Overview](#overview)
|
|
5
|
+
- [Installation](#installation)
|
|
6
|
+
- [Pipes](#pipes)
|
|
7
|
+
- [Usage Examples](#usage-examples)
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
---
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
> Note: Don't forget to add `--project ngx-st-date-format` or else it will be added to the default project in your `angular.json` file.
|
|
11
|
+
## Overview
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
The `ngx-st-date-format` library provides Angular pipes for formatting dates and times using the browser's locale.
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
**Pipes included:**
|
|
16
|
+
- `stDateFormatPipe`: Formats dates
|
|
17
|
+
- `stDateTimeFormatPipe`: Formats dates with time
|
|
18
|
+
- `stTimeFormatPipe`: Formats time only
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
---
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
## Installation
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
```bash
|
|
25
|
+
npm install ngx-st-date-format
|
|
26
|
+
```
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
Import the module:
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
```typescript
|
|
31
|
+
import { StDateFormatModule } from 'ngx-st-date-format';
|
|
32
|
+
|
|
33
|
+
@NgModule({
|
|
34
|
+
imports: [StDateFormatModule]
|
|
35
|
+
})
|
|
36
|
+
export class AppModule { }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Pipes
|
|
42
|
+
|
|
43
|
+
### `stDateFormatPipe`
|
|
44
|
+
Formats a date using `toLocaleDateString()`.
|
|
45
|
+
|
|
46
|
+
**Input:** `string | Date | undefined | null`
|
|
47
|
+
**Output:** Formatted date string or empty string
|
|
48
|
+
|
|
49
|
+
**Example:**
|
|
50
|
+
```html
|
|
51
|
+
<p>{{ user.birthDate | stDateFormatPipe }}</p>
|
|
52
|
+
<!-- Output: 1/15/2024 (or locale-specific format) -->
|
|
53
|
+
|
|
54
|
+
<p>{{ '2024-01-15' | stDateFormatPipe }}</p>
|
|
55
|
+
<!-- Output: 1/15/2024 -->
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### `stDateTimeFormatPipe`
|
|
59
|
+
Formats a date with time using `toLocaleString()`.
|
|
60
|
+
|
|
61
|
+
**Input:** `string | Date | undefined | null`
|
|
62
|
+
**Output:** Formatted date and time string or empty string
|
|
63
|
+
|
|
64
|
+
**Example:**
|
|
65
|
+
```html
|
|
66
|
+
<p>{{ order.createdAt | stDateTimeFormatPipe }}</p>
|
|
67
|
+
<!-- Output: 1/15/2024, 2:30:45 PM (or locale-specific format) -->
|
|
68
|
+
|
|
69
|
+
<p>{{ '2024-01-15T14:30:45' | stDateTimeFormatPipe }}</p>
|
|
70
|
+
<!-- Output: 1/15/2024, 2:30:45 PM -->
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### `stTimeFormatPipe`
|
|
74
|
+
Formats time only using `toLocaleTimeString()`.
|
|
75
|
+
|
|
76
|
+
**Input:** `string | Date | undefined | null`
|
|
77
|
+
**Output:** Formatted time string or empty string
|
|
78
|
+
|
|
79
|
+
**Example:**
|
|
80
|
+
```html
|
|
81
|
+
<p>{{ meeting.startTime | stTimeFormatPipe }}</p>
|
|
82
|
+
<!-- Output: 2:30:45 PM (or locale-specific format) -->
|
|
83
|
+
|
|
84
|
+
<p>{{ '2024-01-15T14:30:45' | stTimeFormatPipe }}</p>
|
|
85
|
+
<!-- Output: 2:30:45 PM -->
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Usage Examples
|
|
91
|
+
|
|
92
|
+
### Example 1: User Profile
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
@Component({
|
|
96
|
+
template: `
|
|
97
|
+
<div class="profile">
|
|
98
|
+
<p>Birth Date: {{ user.birthDate | stDateFormatPipe }}</p>
|
|
99
|
+
<p>Registered: {{ user.registeredAt | stDateTimeFormatPipe }}</p>
|
|
100
|
+
<p>Last Login: {{ user.lastLogin | stDateTimeFormatPipe }}</p>
|
|
101
|
+
</div>
|
|
102
|
+
`
|
|
103
|
+
})
|
|
104
|
+
export class ProfileComponent {
|
|
105
|
+
user = {
|
|
106
|
+
birthDate: new Date('1990-05-15'),
|
|
107
|
+
registeredAt: new Date('2020-01-10T10:30:00'),
|
|
108
|
+
lastLogin: new Date()
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Example 2: Order List
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
@Component({
|
|
117
|
+
template: `
|
|
118
|
+
<table>
|
|
119
|
+
<tr *ngFor="let order of orders">
|
|
120
|
+
<td>{{ order.id }}</td>
|
|
121
|
+
<td>{{ order.orderDate | stDateFormatPipe }}</td>
|
|
122
|
+
<td>{{ order.deliveryTime | stTimeFormatPipe }}</td>
|
|
123
|
+
<td>{{ order.createdAt | stDateTimeFormatPipe }}</td>
|
|
124
|
+
</tr>
|
|
125
|
+
</table>
|
|
126
|
+
`
|
|
127
|
+
})
|
|
128
|
+
export class OrderListComponent {
|
|
129
|
+
orders = [
|
|
130
|
+
{
|
|
131
|
+
id: 1,
|
|
132
|
+
orderDate: '2024-01-15',
|
|
133
|
+
deliveryTime: '2024-01-15T14:30:00',
|
|
134
|
+
createdAt: '2024-01-15T10:20:30'
|
|
135
|
+
}
|
|
136
|
+
];
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Example 3: Event Schedule
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
@Component({
|
|
144
|
+
template: `
|
|
145
|
+
<div *ngFor="let event of events">
|
|
146
|
+
<h3>{{ event.name }}</h3>
|
|
147
|
+
<p>Date: {{ event.date | stDateFormatPipe }}</p>
|
|
148
|
+
<p>Time: {{ event.startTime | stTimeFormatPipe }} - {{ event.endTime | stTimeFormatPipe }}</p>
|
|
149
|
+
</div>
|
|
150
|
+
`
|
|
151
|
+
})
|
|
152
|
+
export class EventScheduleComponent {
|
|
153
|
+
events = [
|
|
154
|
+
{
|
|
155
|
+
name: 'Team Meeting',
|
|
156
|
+
date: '2024-01-20',
|
|
157
|
+
startTime: '2024-01-20T09:00:00',
|
|
158
|
+
endTime: '2024-01-20T10:30:00'
|
|
159
|
+
}
|
|
160
|
+
];
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Behavior
|
|
167
|
+
|
|
168
|
+
- All pipes return empty string for `null` or `undefined` values
|
|
169
|
+
- Dates are formatted using browser's locale settings
|
|
170
|
+
- Accepts both Date objects and date strings
|
|
171
|
+
- Uses native JavaScript date formatting methods
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
This library provides simple, locale-aware date formatting without additional configuration.
|
|
23
176
|
|
|
24
|
-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
@@ -9,11 +9,11 @@ export class StDateFormatModule {
|
|
|
9
9
|
this.matIconRegistry = matIconRegistry;
|
|
10
10
|
this.matIconRegistry.setDefaultFontSetClass('material-symbols-outlined');
|
|
11
11
|
}
|
|
12
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
13
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
14
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule, deps: [{ token: i1.MatIconRegistry }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
13
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule, declarations: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe], exports: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe] }); }
|
|
14
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule }); }
|
|
15
15
|
}
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule, decorators: [{
|
|
17
17
|
type: NgModule,
|
|
18
18
|
args: [{
|
|
19
19
|
declarations: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe],
|
|
@@ -15,10 +15,10 @@ export class DateFormatPipe {
|
|
|
15
15
|
return '';
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
19
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
18
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
19
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: DateFormatPipe, name: "stDateFormatPipe" }); }
|
|
20
20
|
}
|
|
21
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateFormatPipe, decorators: [{
|
|
22
22
|
type: Pipe,
|
|
23
23
|
args: [{
|
|
24
24
|
name: 'stDateFormatPipe',
|
|
@@ -15,10 +15,10 @@ export class DateTimeFormatPipe {
|
|
|
15
15
|
return '';
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
19
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
18
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateTimeFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
19
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: DateTimeFormatPipe, name: "stDateTimeFormatPipe" }); }
|
|
20
20
|
}
|
|
21
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateTimeFormatPipe, decorators: [{
|
|
22
22
|
type: Pipe,
|
|
23
23
|
args: [{
|
|
24
24
|
name: 'stDateTimeFormatPipe',
|
|
@@ -21,10 +21,10 @@ export class TimeFormatPipe {
|
|
|
21
21
|
return '';
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
25
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
24
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TimeFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
25
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: TimeFormatPipe, name: "stTimeFormatPipe" }); }
|
|
26
26
|
}
|
|
27
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TimeFormatPipe, decorators: [{
|
|
28
28
|
type: Pipe,
|
|
29
29
|
args: [{
|
|
30
30
|
name: 'stTimeFormatPipe',
|
|
@@ -17,10 +17,10 @@ class DateFormatPipe {
|
|
|
17
17
|
return '';
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
21
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
20
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
21
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: DateFormatPipe, name: "stDateFormatPipe" }); }
|
|
22
22
|
}
|
|
23
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateFormatPipe, decorators: [{
|
|
24
24
|
type: Pipe,
|
|
25
25
|
args: [{
|
|
26
26
|
name: 'stDateFormatPipe',
|
|
@@ -42,10 +42,10 @@ class DateTimeFormatPipe {
|
|
|
42
42
|
return '';
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
46
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
45
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateTimeFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
46
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: DateTimeFormatPipe, name: "stDateTimeFormatPipe" }); }
|
|
47
47
|
}
|
|
48
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateTimeFormatPipe, decorators: [{
|
|
49
49
|
type: Pipe,
|
|
50
50
|
args: [{
|
|
51
51
|
name: 'stDateTimeFormatPipe',
|
|
@@ -73,10 +73,10 @@ class TimeFormatPipe {
|
|
|
73
73
|
return '';
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
77
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
76
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TimeFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
77
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: TimeFormatPipe, name: "stTimeFormatPipe" }); }
|
|
78
78
|
}
|
|
79
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TimeFormatPipe, decorators: [{
|
|
80
80
|
type: Pipe,
|
|
81
81
|
args: [{
|
|
82
82
|
name: 'stTimeFormatPipe',
|
|
@@ -88,11 +88,11 @@ class StDateFormatModule {
|
|
|
88
88
|
this.matIconRegistry = matIconRegistry;
|
|
89
89
|
this.matIconRegistry.setDefaultFontSetClass('material-symbols-outlined');
|
|
90
90
|
}
|
|
91
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
92
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
93
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
91
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule, deps: [{ token: i1.MatIconRegistry }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
92
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule, declarations: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe], exports: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe] }); }
|
|
93
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule }); }
|
|
94
94
|
}
|
|
95
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
95
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule, decorators: [{
|
|
96
96
|
type: NgModule,
|
|
97
97
|
args: [{
|
|
98
98
|
declarations: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe],
|
|
@@ -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/ngx-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 constructor() {}\r\n\r\n transform(value: string | Date | undefined | null): string {\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 constructor() {}\r\n\r\n transform(value: string | Date | undefined | null): string {\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 constructor() {}\r\n\r\n transform(value: string | Date | undefined | null): string {\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\nimport { MatIconRegistry } from '@angular/material/icon';\r\n\r\n@NgModule({\r\n declarations: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe],\r\n imports: [],\r\n exports: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe],\r\n})\r\nexport class StDateFormatModule {\r\n constructor(private matIconRegistry: MatIconRegistry) {\r\n this.matIconRegistry.setDefaultFontSetClass('material-symbols-outlined');\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/ngx-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,WAAA,GAAA;
|
|
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/ngx-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 constructor() {}\r\n\r\n transform(value: string | Date | undefined | null): string {\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 constructor() {}\r\n\r\n transform(value: string | Date | undefined | null): string {\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 constructor() {}\r\n\r\n transform(value: string | Date | undefined | null): string {\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\nimport { MatIconRegistry } from '@angular/material/icon';\r\n\r\n@NgModule({\r\n declarations: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe],\r\n imports: [],\r\n exports: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe],\r\n})\r\nexport class StDateFormatModule {\r\n constructor(private matIconRegistry: MatIconRegistry) {\r\n this.matIconRegistry.setDefaultFontSetClass('material-symbols-outlined');\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/ngx-st-date-format.module';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-st-date-format",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^
|
|
6
|
-
"@angular/core": "^
|
|
5
|
+
"@angular/common": "^18.0.0",
|
|
6
|
+
"@angular/core": "^18.0.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"tslib": "^2.3.0"
|