ngx-st-date-format 18.0.0 → 18.0.2

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 CHANGED
@@ -1,24 +1,176 @@
1
- # NgxStDateFormat
1
+ # Date Format Pipes - Complete Documentation
2
2
 
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.0.
3
+ ## Table of Contents
4
+ - [Overview](#overview)
5
+ - [Installation](#installation)
6
+ - [Pipes](#pipes)
7
+ - [Usage Examples](#usage-examples)
4
8
 
5
- ## Code scaffolding
9
+ ---
6
10
 
7
- Run `ng generate component component-name --project ngx-st-date-format` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-st-date-format`.
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
- ## Build
13
+ The `ngx-st-date-format` library provides Angular pipes for formatting dates and times using the browser's locale.
11
14
 
12
- Run `ng build ngx-st-date-format` to build the project. The build artifacts will be stored in the `dist/` directory.
15
+ **Pipes included:**
16
+ - `stDateFormatPipe`: Formats dates
17
+ - `stDateTimeFormatPipe`: Formats dates with time
18
+ - `stTimeFormatPipe`: Formats time only
13
19
 
14
- ## Publishing
20
+ ---
15
21
 
16
- After building your library with `ng build ngx-st-date-format`, go to the dist folder `cd dist/ngx-st-date-format` and run `npm publish`.
22
+ ## Installation
17
23
 
18
- ## Running unit tests
24
+ ```bash
25
+ npm install ngx-st-date-format
26
+ ```
19
27
 
20
- Run `ng test ngx-st-date-format` to execute the unit tests via [Karma](https://karma-runner.github.io).
28
+ Import the module:
21
29
 
22
- ## Further help
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.
@@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
2
2
  import { DateFormatPipe } from './pipes/date-format.pipe';
3
3
  import { DateTimeFormatPipe } from './pipes/date-time-format.pipe';
4
4
  import { TimeFormatPipe } from './pipes/time-format.pipe';
5
+ import { DateWithoutTimezoneFormatPipe } from './pipes/date-without-timezone-format.pipe';
5
6
  import * as i0 from "@angular/core";
6
7
  import * as i1 from "@angular/material/icon";
7
8
  export class StDateFormatModule {
@@ -10,15 +11,23 @@ export class StDateFormatModule {
10
11
  this.matIconRegistry.setDefaultFontSetClass('material-symbols-outlined');
11
12
  }
12
13
  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.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule, declarations: [DateFormatPipe,
15
+ DateTimeFormatPipe,
16
+ TimeFormatPipe,
17
+ DateWithoutTimezoneFormatPipe], exports: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe] }); }
14
18
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule }); }
15
19
  }
16
20
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule, decorators: [{
17
21
  type: NgModule,
18
22
  args: [{
19
- declarations: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe],
23
+ declarations: [
24
+ DateFormatPipe,
25
+ DateTimeFormatPipe,
26
+ TimeFormatPipe,
27
+ DateWithoutTimezoneFormatPipe,
28
+ ],
20
29
  imports: [],
21
30
  exports: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe],
22
31
  }]
23
32
  }], ctorParameters: () => [{ type: i1.MatIconRegistry }] });
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXN0LWRhdGUtZm9ybWF0Lm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1zdC1kYXRlLWZvcm1hdC9zcmMvbGliL25neC1zdC1kYXRlLWZvcm1hdC5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDMUQsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDbkUsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLDBCQUEwQixDQUFDOzs7QUFRMUQsTUFBTSxPQUFPLGtCQUFrQjtJQUM3QixZQUFvQixlQUFnQztRQUFoQyxvQkFBZSxHQUFmLGVBQWUsQ0FBaUI7UUFDbEQsSUFBSSxDQUFDLGVBQWUsQ0FBQyxzQkFBc0IsQ0FBQywyQkFBMkIsQ0FBQyxDQUFDO0lBQzNFLENBQUM7K0dBSFUsa0JBQWtCO2dIQUFsQixrQkFBa0IsaUJBSmQsY0FBYyxFQUFFLGtCQUFrQixFQUFFLGNBQWMsYUFFdkQsY0FBYyxFQUFFLGtCQUFrQixFQUFFLGNBQWM7Z0hBRWpELGtCQUFrQjs7NEZBQWxCLGtCQUFrQjtrQkFMOUIsUUFBUTttQkFBQztvQkFDUixZQUFZLEVBQUUsQ0FBQyxjQUFjLEVBQUUsa0JBQWtCLEVBQUUsY0FBYyxDQUFDO29CQUNsRSxPQUFPLEVBQUUsRU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cclxuICAgIHRoaXMubWF0SWNvblJlZ2lzdHJ5LnNldERlZmF1bHRGb250U2V0Q2xhc3MoJ21hdGVyaWFsLXN5bWJvbHMtb3V0bGluZWQnKTtcclxuICB9XHJcbn1cclxuIl19
@@ -0,0 +1,46 @@
1
+ import { Pipe } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export class DateWithoutTimezoneFormatPipe {
4
+ constructor() { }
5
+ transform(value) {
6
+ if (value) {
7
+ let day, month, year;
8
+ if (value instanceof Date) {
9
+ day = value.getDate();
10
+ month = value.getMonth() + 1;
11
+ year = value.getFullYear();
12
+ }
13
+ else {
14
+ // Parse date string to extract date components (ignore timezone)
15
+ const dateMatch = value.match(/^(\d{4})-(\d{2})-(\d{2})/);
16
+ if (dateMatch) {
17
+ year = parseInt(dateMatch[1], 10);
18
+ month = parseInt(dateMatch[2], 10);
19
+ day = parseInt(dateMatch[3], 10);
20
+ }
21
+ else {
22
+ // Fallback for other formats
23
+ const date = new Date(value);
24
+ day = date.getDate();
25
+ month = date.getMonth() + 1;
26
+ year = date.getFullYear();
27
+ }
28
+ }
29
+ // Create local date with extracted components (no timezone conversion)
30
+ const localDate = new Date(year, month - 1, day);
31
+ return localDate.toLocaleDateString();
32
+ }
33
+ else {
34
+ return '';
35
+ }
36
+ }
37
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateWithoutTimezoneFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
38
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: DateWithoutTimezoneFormatPipe, name: "stDateWithoutTimezoneFormatPipe" }); }
39
+ }
40
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateWithoutTimezoneFormatPipe, decorators: [{
41
+ type: Pipe,
42
+ args: [{
43
+ name: 'stDateWithoutTimezoneFormatPipe',
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UgPSBuZXcgRGF0ZSh2YWx1ZSk7XHJcbiAgICAgICAgICBkYXkgPSBkYXRlLmdldERhdGUoKTtcclxuICAgICAgICAgIG1vbnRoID0gZGF0ZS5nZXRNb250aCgpICsgMTtcclxuICAgICAgICAgIHllYXIgPSBkYXRlLmdldEZ1bGxZZWFyKCk7XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcblxyXG4gICAgICAvLyBDcmVhdGUgbG9jYWwgZGF0ZSB3aXRoIGV4dHJhY3RlZCBjb21wb25lbnRzIChubyB0aW1lem9uZSBjb252ZXJzaW9uKVxyXG4gICAgICBjb25zdCBsb2NhbERhdGUgPSBuZXcgRGF0ZSh5ZWFyLCBtb250aCAtIDEsIGRheSk7XHJcbiAgICAgIHJldHVybiBsb2NhbERhdGUudG9Mb2NhbGVEYXRlU3RyaW5nKCk7XHJcbiAgICB9IGVsc2Uge1xyXG4gICAgICByZXR1cm4gJyc7XHJcbiAgICB9XHJcbiAgfVxyXG59XHJcbiJdfQ==
@@ -4,5 +4,6 @@
4
4
  export * from './lib/pipes/date-format.pipe';
5
5
  export * from './lib/pipes/date-time-format.pipe';
6
6
  export * from './lib/pipes/time-format.pipe';
7
+ export * from './lib/pipes/date-without-timezone-format.pipe';
7
8
  export * from './lib/ngx-st-date-format.module';
8
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25neC1zdC1kYXRlLWZvcm1hdC9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsOEJBQThCLENBQUM7QUFDN0MsY0FBYyxtQ0FBbUMsQ0FBQztBQUNsRCxjQUFjLDhCQUE4QixDQUFDO0FBQzdDLGNBQWMsaUNBQWlDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6W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CAqIGZyb20gJy4vbGliL3BpcGVzL2RhdGUtd2l0aG91dC10aW1lem9uZS1mb3JtYXQucGlwZSc7XHJcbmV4cG9ydCAqIGZyb20gJy4vbGliL25neC1zdC1kYXRlLWZvcm1hdC5tb2R1bGUnO1xyXG4iXX0=
@@ -83,19 +83,71 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
83
83
  }]
84
84
  }], ctorParameters: () => [] });
85
85
 
86
+ class DateWithoutTimezoneFormatPipe {
87
+ constructor() { }
88
+ transform(value) {
89
+ if (value) {
90
+ let day, month, year;
91
+ if (value instanceof Date) {
92
+ day = value.getDate();
93
+ month = value.getMonth() + 1;
94
+ year = value.getFullYear();
95
+ }
96
+ else {
97
+ // Parse date string to extract date components (ignore timezone)
98
+ const dateMatch = value.match(/^(\d{4})-(\d{2})-(\d{2})/);
99
+ if (dateMatch) {
100
+ year = parseInt(dateMatch[1], 10);
101
+ month = parseInt(dateMatch[2], 10);
102
+ day = parseInt(dateMatch[3], 10);
103
+ }
104
+ else {
105
+ // Fallback for other formats
106
+ const date = new Date(value);
107
+ day = date.getDate();
108
+ month = date.getMonth() + 1;
109
+ year = date.getFullYear();
110
+ }
111
+ }
112
+ // Create local date with extracted components (no timezone conversion)
113
+ const localDate = new Date(year, month - 1, day);
114
+ return localDate.toLocaleDateString();
115
+ }
116
+ else {
117
+ return '';
118
+ }
119
+ }
120
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateWithoutTimezoneFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
121
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: DateWithoutTimezoneFormatPipe, name: "stDateWithoutTimezoneFormatPipe" }); }
122
+ }
123
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateWithoutTimezoneFormatPipe, decorators: [{
124
+ type: Pipe,
125
+ args: [{
126
+ name: 'stDateWithoutTimezoneFormatPipe',
127
+ }]
128
+ }], ctorParameters: () => [] });
129
+
86
130
  class StDateFormatModule {
87
131
  constructor(matIconRegistry) {
88
132
  this.matIconRegistry = matIconRegistry;
89
133
  this.matIconRegistry.setDefaultFontSetClass('material-symbols-outlined');
90
134
  }
91
135
  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] }); }
136
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule, declarations: [DateFormatPipe,
137
+ DateTimeFormatPipe,
138
+ TimeFormatPipe,
139
+ DateWithoutTimezoneFormatPipe], exports: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe] }); }
93
140
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule }); }
94
141
  }
95
142
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StDateFormatModule, decorators: [{
96
143
  type: NgModule,
97
144
  args: [{
98
- declarations: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe],
145
+ declarations: [
146
+ DateFormatPipe,
147
+ DateTimeFormatPipe,
148
+ TimeFormatPipe,
149
+ DateWithoutTimezoneFormatPipe,
150
+ ],
99
151
  imports: [],
100
152
  exports: [DateFormatPipe, DateTimeFormatPipe, TimeFormatPipe],
101
153
  }]
@@ -109,5 +161,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
109
161
  * Generated bundle index. Do not edit.
110
162
  */
111
163
 
112
- export { DateFormatPipe, DateTimeFormatPipe, StDateFormatModule, TimeFormatPipe };
164
+ export { DateFormatPipe, DateTimeFormatPipe, DateWithoutTimezoneFormatPipe, StDateFormatModule, TimeFormatPipe };
113
165
  //# sourceMappingURL=ngx-st-date-format.mjs.map
@@ -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,GAAgB;AAEhB,IAAA,SAAS,CAAC,KAAuC,EAAA;QAC/C,IAAI,KAAK,EAAE;AACT,YAAA,IAAI,KAAK,YAAY,IAAI,EAAE;AACzB,gBAAA,OAAO,KAAK,CAAC,kBAAkB,EAAE,CAAC;aACnC;iBAAM;gBACL,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,kBAAkB,EAAE,CAAC;aAC7C;SACF;aAAM;AACL,YAAA,OAAO,EAAE,CAAC;SACX;KACF;+GAbU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Y,EAAE,CAAC,cAAc,EAAE,kBAAkB,EAAE,cAAc,CAAC;AAClE,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,CAAC,cAAc,EAAE,kBAAkB,EAAE,cAAc,CAAC;AAC9D,iBAAA,CAAA;;;ACVD;;AAEG;;ACFH;;AAEG;;;;"}
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/pipes/date-without-timezone-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 { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'stDateWithoutTimezoneFormatPipe',\r\n})\r\nexport class DateWithoutTimezoneFormatPipe implements PipeTransform {\r\n constructor() {}\r\n\r\n transform(value: string | Date | undefined | null): string {\r\n if (value) {\r\n let day: number, month: number, year: number;\r\n\r\n if (value instanceof Date) {\r\n day = value.getDate();\r\n month = value.getMonth() + 1;\r\n year = value.getFullYear();\r\n } else {\r\n // Parse date string to extract date components (ignore timezone)\r\n const dateMatch = value.match(/^(\\d{4})-(\\d{2})-(\\d{2})/);\r\n if (dateMatch) {\r\n year = parseInt(dateMatch[1], 10);\r\n month = parseInt(dateMatch[2], 10);\r\n day = parseInt(dateMatch[3], 10);\r\n } else {\r\n // Fallback for other formats\r\n const date = new Date(value);\r\n day = date.getDate();\r\n month = date.getMonth() + 1;\r\n year = date.getFullYear();\r\n }\r\n }\r\n\r\n // Create local date with extracted components (no timezone conversion)\r\n const localDate = new Date(year, month - 1, day);\r\n return localDate.toLocaleDateString();\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\nimport { DateWithoutTimezoneFormatPipe } from './pipes/date-without-timezone-format.pipe';\r\n\r\n@NgModule({\r\n declarations: [\r\n DateFormatPipe,\r\n DateTimeFormatPipe,\r\n TimeFormatPipe,\r\n DateWithoutTimezoneFormatPipe,\r\n ],\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/pipes/date-without-timezone-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,GAAgB;AAEhB,IAAA,SAAS,CAAC,KAAuC,EAAA;QAC/C,IAAI,KAAK,EAAE;AACT,YAAA,IAAI,KAAK,YAAY,IAAI,EAAE;AACzB,gBAAA,OAAO,KAAK,CAAC,kBAAkB,EAAE,CAAC;aACnC;iBAAM;gBACL,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,kBAAkB,EAAE,CAAC;aAC7C;SACF;aAAM;AACL,YAAA,OAAO,EAAE,CAAC;SACX;KACF;+GAbU,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA,EAAA;6GAAd,cAAc,EAAA,IAAA,EAAA,kBAAA,EAAA,CAAA,CAAA,EAAA;;4FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,kBAAkB;AACzB,iBAAA,CAAA;;;MCCY,kBAAkB,CAAA;AAC7B,IAAA,WAAA,GAAA,GAAgB;AAEhB,IAAA,SAAS,CAAC,KAAuC,EAAA;QAC/C,IAAI,KAAK,EAAE;AACT,YAAA,IAAI,KAAK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AAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,cAAc;wBACd,kBAAkB;wBAClB,cAAc;wBACd,6BAA6B;AAC9B,qBAAA;AACD,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,CAAC,cAAc,EAAE,kBAAkB,EAAE,cAAc,CAAC;AAC9D,iBAAA,CAAA;;;AChBD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -3,10 +3,11 @@ import * as i0 from "@angular/core";
3
3
  import * as i1 from "./pipes/date-format.pipe";
4
4
  import * as i2 from "./pipes/date-time-format.pipe";
5
5
  import * as i3 from "./pipes/time-format.pipe";
6
+ import * as i4 from "./pipes/date-without-timezone-format.pipe";
6
7
  export declare class StDateFormatModule {
7
8
  private matIconRegistry;
8
9
  constructor(matIconRegistry: MatIconRegistry);
9
10
  static ɵfac: i0.ɵɵFactoryDeclaration<StDateFormatModule, never>;
10
- static ɵmod: i0.ɵɵNgModuleDeclaration<StDateFormatModule, [typeof i1.DateFormatPipe, typeof i2.DateTimeFormatPipe, typeof i3.TimeFormatPipe], never, [typeof i1.DateFormatPipe, typeof i2.DateTimeFormatPipe, typeof i3.TimeFormatPipe]>;
11
+ static ɵmod: i0.ɵɵNgModuleDeclaration<StDateFormatModule, [typeof i1.DateFormatPipe, typeof i2.DateTimeFormatPipe, typeof i3.TimeFormatPipe, typeof i4.DateWithoutTimezoneFormatPipe], never, [typeof i1.DateFormatPipe, typeof i2.DateTimeFormatPipe, typeof i3.TimeFormatPipe]>;
11
12
  static ɵinj: i0.ɵɵInjectorDeclaration<StDateFormatModule>;
12
13
  }
@@ -0,0 +1,8 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class DateWithoutTimezoneFormatPipe implements PipeTransform {
4
+ constructor();
5
+ transform(value: string | Date | undefined | null): string;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<DateWithoutTimezoneFormatPipe, never>;
7
+ static ɵpipe: i0.ɵɵPipeDeclaration<DateWithoutTimezoneFormatPipe, "stDateWithoutTimezoneFormatPipe", false>;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-st-date-format",
3
- "version": "18.0.0",
3
+ "version": "18.0.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^18.0.0",
6
6
  "@angular/core": "^18.0.0"
package/public-api.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './lib/pipes/date-format.pipe';
2
2
  export * from './lib/pipes/date-time-format.pipe';
3
3
  export * from './lib/pipes/time-format.pipe';
4
+ export * from './lib/pipes/date-without-timezone-format.pipe';
4
5
  export * from './lib/ngx-st-date-format.module';