hijri-date-time-picker 1.0.31 → 1.0.32
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/fesm2022/hijri-date-time-picker.mjs +786 -0
- package/fesm2022/hijri-date-time-picker.mjs.map +1 -0
- package/package.json +14 -16
- package/types/hijri-date-time-picker.d.ts +179 -0
- package/QUICKSTART.md +0 -121
- package/docs/INITIAL_DATE_BINDING.md +0 -183
- package/docs/MIN_MAX_DATE.md +0 -326
- package/ng-package.json +0 -11
- package/src/demo.ts +0 -246
- package/src/index.ts +0 -2
- package/src/lib/hijri-date-picker.component.css +0 -524
- package/src/lib/hijri-date-picker.component.html +0 -229
- package/src/lib/hijri-date-picker.component.ts +0 -795
- package/src/lib/hijri-date-picker.types.ts +0 -164
- package/src/types/hijri-date.d.ts +0 -43
- package/tsconfig.json +0 -39
package/docs/MIN_MAX_DATE.md
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
# Min/Max Date Feature Guide
|
|
2
|
-
|
|
3
|
-
This guide demonstrates how to use the `minDate` and `maxDate` features in the Hijri Date Time Picker component to restrict date selection within specific ranges.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The `minDate` and `maxDate` inputs allow you to define the earliest and latest dates that users can select. Dates outside this range will be disabled and cannot be selected.
|
|
8
|
-
|
|
9
|
-
## Basic Usage
|
|
10
|
-
|
|
11
|
-
### Setting a Minimum Date
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { Component } from '@angular/core';
|
|
15
|
-
import { HijriDatePickerComponent } from 'hijri-date-time-picker';
|
|
16
|
-
|
|
17
|
-
@Component({
|
|
18
|
-
selector: 'app-example',
|
|
19
|
-
standalone: true,
|
|
20
|
-
imports: [HijriDatePickerComponent],
|
|
21
|
-
template: `
|
|
22
|
-
<hijri-date-picker
|
|
23
|
-
[minDate]="minDate"
|
|
24
|
-
(dateSelected)="onDateSelected($event)">
|
|
25
|
-
</hijri-date-picker>
|
|
26
|
-
`
|
|
27
|
-
})
|
|
28
|
-
export class ExampleComponent {
|
|
29
|
-
// Only allow dates from today onwards
|
|
30
|
-
minDate = new Date();
|
|
31
|
-
|
|
32
|
-
onDateSelected(date: any) {
|
|
33
|
-
console.log('Selected:', date);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Setting a Maximum Date
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
@Component({
|
|
42
|
-
template: `
|
|
43
|
-
<hijri-date-picker
|
|
44
|
-
[maxDate]="maxDate"
|
|
45
|
-
(dateSelected)="onDateSelected($event)">
|
|
46
|
-
</hijri-date-picker>
|
|
47
|
-
`
|
|
48
|
-
})
|
|
49
|
-
export class ExampleComponent {
|
|
50
|
-
// Only allow dates up to today
|
|
51
|
-
maxDate = new Date();
|
|
52
|
-
|
|
53
|
-
onDateSelected(date: any) {
|
|
54
|
-
console.log('Selected:', date);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Combining Min and Max Dates
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
@Component({
|
|
63
|
-
template: `
|
|
64
|
-
<hijri-date-picker
|
|
65
|
-
[minDate]="minDate"
|
|
66
|
-
[maxDate]="maxDate"
|
|
67
|
-
[futureValidation]="false"
|
|
68
|
-
(dateSelected)="onDateSelected($event)">
|
|
69
|
-
</hijri-date-picker>
|
|
70
|
-
`
|
|
71
|
-
})
|
|
72
|
-
export class ExampleComponent {
|
|
73
|
-
// Allow only dates within the last 30 days
|
|
74
|
-
minDate = new Date(new Date().setDate(new Date().getDate() - 30));
|
|
75
|
-
maxDate = new Date();
|
|
76
|
-
|
|
77
|
-
onDateSelected(date: any) {
|
|
78
|
-
console.log('Selected:', date);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Common Use Cases
|
|
84
|
-
|
|
85
|
-
### 1. Booking System (Future Dates Only)
|
|
86
|
-
|
|
87
|
-
```typescript
|
|
88
|
-
export class BookingComponent {
|
|
89
|
-
// Start from today
|
|
90
|
-
minDate = new Date();
|
|
91
|
-
|
|
92
|
-
// Allow bookings up to 90 days in advance
|
|
93
|
-
maxDate = new Date(new Date().setDate(new Date().getDate() + 90));
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### 2. Historical Data Entry (Past Dates Only)
|
|
98
|
-
|
|
99
|
-
```typescript
|
|
100
|
-
export class HistoricalDataComponent {
|
|
101
|
-
// Allow dates from January 1, 2000
|
|
102
|
-
minDate = new Date('2000-01-01');
|
|
103
|
-
|
|
104
|
-
// Up to yesterday
|
|
105
|
-
maxDate = new Date(new Date().setDate(new Date().getDate() - 1));
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### 3. Event Registration (Specific Date Range)
|
|
110
|
-
|
|
111
|
-
```typescript
|
|
112
|
-
export class EventRegistrationComponent {
|
|
113
|
-
// Registration opens on a specific date
|
|
114
|
-
minDate = new Date('2024-01-15');
|
|
115
|
-
|
|
116
|
-
// Registration closes on event date
|
|
117
|
-
maxDate = new Date('2024-03-30');
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### 4. Age Verification (Date of Birth)
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
export class AgeVerificationComponent {
|
|
125
|
-
// Must be at least 18 years old
|
|
126
|
-
maxDate = new Date(
|
|
127
|
-
new Date().setFullYear(new Date().getFullYear() - 18)
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
// Maximum age of 100 years
|
|
131
|
-
minDate = new Date(
|
|
132
|
-
new Date().setFullYear(new Date().getFullYear() - 100)
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### 5. Dynamic Date Range
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
export class DynamicRangeComponent {
|
|
141
|
-
minDate: Date;
|
|
142
|
-
maxDate: Date;
|
|
143
|
-
|
|
144
|
-
constructor() {
|
|
145
|
-
this.updateDateRange('last30days');
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
updateDateRange(range: string) {
|
|
149
|
-
const today = new Date();
|
|
150
|
-
|
|
151
|
-
switch(range) {
|
|
152
|
-
case 'last7days':
|
|
153
|
-
this.minDate = new Date(today.setDate(today.getDate() - 7));
|
|
154
|
-
this.maxDate = new Date();
|
|
155
|
-
break;
|
|
156
|
-
|
|
157
|
-
case 'last30days':
|
|
158
|
-
this.minDate = new Date(today.setDate(today.getDate() - 30));
|
|
159
|
-
this.maxDate = new Date();
|
|
160
|
-
break;
|
|
161
|
-
|
|
162
|
-
case 'next30days':
|
|
163
|
-
this.minDate = new Date();
|
|
164
|
-
this.maxDate = new Date(today.setDate(today.getDate() + 30));
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Working with Hijri Calendar
|
|
172
|
-
|
|
173
|
-
The `minDate` and `maxDate` work seamlessly with both Gregorian and Hijri calendars. The component automatically converts the dates to the appropriate calendar system.
|
|
174
|
-
|
|
175
|
-
```typescript
|
|
176
|
-
@Component({
|
|
177
|
-
template: `
|
|
178
|
-
<hijri-date-picker
|
|
179
|
-
[mode]="'hijri'"
|
|
180
|
-
[minDate]="minDate"
|
|
181
|
-
[maxDate]="maxDate"
|
|
182
|
-
[locale]="'ar'"
|
|
183
|
-
[dir]="'rtl'"
|
|
184
|
-
(dateSelected)="onDateSelected($event)">
|
|
185
|
-
</hijri-date-picker>
|
|
186
|
-
`
|
|
187
|
-
})
|
|
188
|
-
export class HijriRangeComponent {
|
|
189
|
-
// The dates are in Gregorian, but will be converted to Hijri
|
|
190
|
-
minDate = new Date('2024-01-01');
|
|
191
|
-
maxDate = new Date('2024-12-31');
|
|
192
|
-
|
|
193
|
-
onDateSelected(date: any) {
|
|
194
|
-
// date object contains both Gregorian and Hijri representations
|
|
195
|
-
console.log('Gregorian:', date.gregorian);
|
|
196
|
-
console.log('Hijri:', date.hijri);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Disabling Future Validation
|
|
202
|
-
|
|
203
|
-
When using `minDate` and `maxDate`, you may want to disable the default `futureValidation` feature:
|
|
204
|
-
|
|
205
|
-
```typescript
|
|
206
|
-
@Component({
|
|
207
|
-
template: `
|
|
208
|
-
<hijri-date-picker
|
|
209
|
-
[minDate]="minDate"
|
|
210
|
-
[maxDate]="maxDate"
|
|
211
|
-
[futureValidation]="false"
|
|
212
|
-
(dateSelected)="onDateSelected($event)">
|
|
213
|
-
</hijri-date-picker>
|
|
214
|
-
`
|
|
215
|
-
})
|
|
216
|
-
export class CustomRangeComponent {
|
|
217
|
-
minDate = new Date('2024-01-01');
|
|
218
|
-
maxDate = new Date('2025-12-31');
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
## Year and Month Picker Behavior
|
|
223
|
-
|
|
224
|
-
When `minDate` and `maxDate` are set:
|
|
225
|
-
|
|
226
|
-
- The **year dropdown** will only show years within the valid range
|
|
227
|
-
- The **month navigation** remains functional, but disabled dates will be shown as disabled
|
|
228
|
-
- Users cannot select disabled dates even if they navigate to those months
|
|
229
|
-
|
|
230
|
-
## Tips and Best Practices
|
|
231
|
-
|
|
232
|
-
1. **Always set both min and max**: For the best user experience, set both `minDate` and `maxDate` to clearly define the valid range.
|
|
233
|
-
|
|
234
|
-
2. **Disable futureValidation**: When using custom date ranges, set `[futureValidation]="false"` to avoid conflicts.
|
|
235
|
-
|
|
236
|
-
3. **Provide feedback**: Consider showing the valid date range in your UI:
|
|
237
|
-
```html
|
|
238
|
-
<p>Please select a date between {{ minDate | date }} and {{ maxDate | date }}</p>
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
4. **Dynamic ranges**: Update `minDate` and `maxDate` dynamically based on user input or business logic.
|
|
242
|
-
|
|
243
|
-
5. **Time considerations**: The date comparison ignores the time component, so:
|
|
244
|
-
```typescript
|
|
245
|
-
minDate = new Date(); // Today at current time
|
|
246
|
-
// Will allow selection of today's date, regardless of current time
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
## Combining with Other Features
|
|
250
|
-
|
|
251
|
-
### With Multiple Selection
|
|
252
|
-
|
|
253
|
-
```typescript
|
|
254
|
-
@Component({
|
|
255
|
-
template: `
|
|
256
|
-
<hijri-date-picker
|
|
257
|
-
[multiple]="true"
|
|
258
|
-
[minDate]="minDate"
|
|
259
|
-
[maxDate]="maxDate"
|
|
260
|
-
[showConfirmButton]="true"
|
|
261
|
-
(dateSelected)="onDatesSelected($event)">
|
|
262
|
-
</hijri-date-picker>
|
|
263
|
-
`
|
|
264
|
-
})
|
|
265
|
-
export class MultipleWithRangeComponent {
|
|
266
|
-
minDate = new Date(new Date().setDate(new Date().getDate() - 7));
|
|
267
|
-
maxDate = new Date();
|
|
268
|
-
|
|
269
|
-
onDatesSelected(dates: any[]) {
|
|
270
|
-
console.log('Selected dates:', dates);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
### With Time Selection
|
|
276
|
-
|
|
277
|
-
```typescript
|
|
278
|
-
@Component({
|
|
279
|
-
template: `
|
|
280
|
-
<hijri-date-picker
|
|
281
|
-
[enableTime]="true"
|
|
282
|
-
[minDate]="minDate"
|
|
283
|
-
[maxDate]="maxDate"
|
|
284
|
-
[futureValidation]="false"
|
|
285
|
-
(dateSelected)="onDateTimeSelected($event)">
|
|
286
|
-
</hijri-date-picker>
|
|
287
|
-
`
|
|
288
|
-
})
|
|
289
|
-
export class DateTimeWithRangeComponent {
|
|
290
|
-
minDate = new Date();
|
|
291
|
-
maxDate = new Date(new Date().setDate(new Date().getDate() + 30));
|
|
292
|
-
|
|
293
|
-
onDateTimeSelected(dateTime: any) {
|
|
294
|
-
console.log('Selected date and time:', dateTime);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
## API Reference
|
|
300
|
-
|
|
301
|
-
| Property | Type | Default | Description |
|
|
302
|
-
|----------|------|---------|-------------|
|
|
303
|
-
| `minDate` | `Date \| undefined` | `undefined` | Minimum selectable date. Dates before this will be disabled. |
|
|
304
|
-
| `maxDate` | `Date \| undefined` | `undefined` | Maximum selectable date. Dates after this will be disabled. |
|
|
305
|
-
|
|
306
|
-
## Browser Compatibility
|
|
307
|
-
|
|
308
|
-
The minDate/maxDate feature works in all modern browsers that support the Date object and Angular framework.
|
|
309
|
-
|
|
310
|
-
## Troubleshooting
|
|
311
|
-
|
|
312
|
-
### Dates not being disabled
|
|
313
|
-
|
|
314
|
-
- Verify that `minDate` and `maxDate` are valid Date objects
|
|
315
|
-
- Check that `futureValidation` is set to `false` if you're using custom ranges
|
|
316
|
-
- Ensure dates are in the correct format
|
|
317
|
-
|
|
318
|
-
### Year dropdown showing wrong years
|
|
319
|
-
|
|
320
|
-
- The year dropdown automatically adjusts based on `minDate` and `maxDate`
|
|
321
|
-
- If you see unexpected years, check your date values
|
|
322
|
-
|
|
323
|
-
### Timezone issues
|
|
324
|
-
|
|
325
|
-
- The component uses local timezone for all date comparisons
|
|
326
|
-
- Be aware of timezone differences when setting dates programmatically
|
package/ng-package.json
DELETED
package/src/demo.ts
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { bootstrapApplication } from '@angular/platform-browser';
|
|
3
|
-
import { HijriDatePickerComponent } from './lib/hijri-date-picker.component';
|
|
4
|
-
import { SelectedDate, DatePickerStyles } from './lib/hijri-date-picker.types';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'app-demo',
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [HijriDatePickerComponent],
|
|
10
|
-
template: `
|
|
11
|
-
<div class="demo-container">
|
|
12
|
-
<h1>Hijri Date Picker Demo</h1>
|
|
13
|
-
|
|
14
|
-
<div class="demo-grid">
|
|
15
|
-
<!-- Example 1: Basic Gregorian -->
|
|
16
|
-
<div class="demo-card">
|
|
17
|
-
<h2>Basic Gregorian</h2>
|
|
18
|
-
<hijri-date-picker
|
|
19
|
-
[mode]="'greg'"
|
|
20
|
-
[locale]="'en'"
|
|
21
|
-
[canChangeMode]="true"
|
|
22
|
-
(dateSelected)="onDateSelected($event, 'basic')">
|
|
23
|
-
</hijri-date-picker>
|
|
24
|
-
<div class="output" *ngIf="selectedDates['basic']">
|
|
25
|
-
<strong>Selected:</strong>
|
|
26
|
-
<pre>{{ selectedDates['basic'] | json }}</pre>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<!-- Example 2: Hijri with Arabic -->
|
|
31
|
-
<div class="demo-card">
|
|
32
|
-
<h2>Hijri Calendar (Arabic)</h2>
|
|
33
|
-
<hijri-date-picker
|
|
34
|
-
[mode]="'hijri'"
|
|
35
|
-
[locale]="'ar'"
|
|
36
|
-
[dir]="'rtl'"
|
|
37
|
-
[canChangeMode]="true"
|
|
38
|
-
[submitTextButton]="'تأكيد'"
|
|
39
|
-
[todaysDateText]="'اليوم'"
|
|
40
|
-
[yearSelectLabel]="'السنة'"
|
|
41
|
-
[monthSelectLabel]="'الشهر'"
|
|
42
|
-
(dateSelected)="onDateSelected($event, 'hijri')">
|
|
43
|
-
</hijri-date-picker>
|
|
44
|
-
<div class="output" *ngIf="selectedDates['hijri']">
|
|
45
|
-
<strong>Selected:</strong>
|
|
46
|
-
<pre>{{ selectedDates['hijri'] | json }}</pre>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<!-- Example 3: Multiple Selection -->
|
|
51
|
-
<div class="demo-card">
|
|
52
|
-
<h2>Multiple Selection</h2>
|
|
53
|
-
<hijri-date-picker
|
|
54
|
-
[mode]="'greg'"
|
|
55
|
-
[locale]="'en'"
|
|
56
|
-
[multiple]="true"
|
|
57
|
-
[showConfirmButton]="true"
|
|
58
|
-
[submitTextButton]="'Confirm Selection'"
|
|
59
|
-
(dateSelected)="onDateSelected($event, 'multiple')">
|
|
60
|
-
</hijri-date-picker>
|
|
61
|
-
<div class="output" *ngIf="selectedDates['multiple']">
|
|
62
|
-
<strong>Selected Dates:</strong>
|
|
63
|
-
<pre>{{ selectedDates['multiple'] | json }}</pre>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<!-- Example 4: Custom Styling -->
|
|
68
|
-
<div class="demo-card">
|
|
69
|
-
<h2>Custom Theme</h2>
|
|
70
|
-
<hijri-date-picker
|
|
71
|
-
[mode]="'greg'"
|
|
72
|
-
[locale]="'en'"
|
|
73
|
-
[styles]="customStyles"
|
|
74
|
-
[canChangeMode]="true"
|
|
75
|
-
(dateSelected)="onDateSelected($event, 'custom')">
|
|
76
|
-
</hijri-date-picker>
|
|
77
|
-
<div class="output" *ngIf="selectedDates['custom']">
|
|
78
|
-
<strong>Selected:</strong>
|
|
79
|
-
<pre>{{ selectedDates['custom'] | json }}</pre>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
<!-- Example 5: Future Date Validation -->
|
|
84
|
-
<div class="demo-card">
|
|
85
|
-
<h2>No Future Dates</h2>
|
|
86
|
-
<hijri-date-picker
|
|
87
|
-
[mode]="'greg'"
|
|
88
|
-
[locale]="'en'"
|
|
89
|
-
[futureValidation]="true"
|
|
90
|
-
[futureYearsLimit]="0"
|
|
91
|
-
[todaysDateText]="'Select Today'"
|
|
92
|
-
(dateSelected)="onDateSelected($event, 'validation')">
|
|
93
|
-
</hijri-date-picker>
|
|
94
|
-
<div class="output" *ngIf="selectedDates['validation']">
|
|
95
|
-
<strong>Selected:</strong>
|
|
96
|
-
<pre>{{ selectedDates['validation'] | json }}</pre>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
<!-- Example 6: Minimal UI -->
|
|
101
|
-
<div class="demo-card">
|
|
102
|
-
<h2>Minimal UI</h2>
|
|
103
|
-
<hijri-date-picker
|
|
104
|
-
[mode]="'greg'"
|
|
105
|
-
[locale]="'en'"
|
|
106
|
-
[canChangeMode]="false"
|
|
107
|
-
[todaysDateSection]="false"
|
|
108
|
-
[disableYearPicker]="true"
|
|
109
|
-
[disableMonthPicker]="true"
|
|
110
|
-
(dateSelected)="onDateSelected($event, 'minimal')">
|
|
111
|
-
</hijri-date-picker>
|
|
112
|
-
<div class="output" *ngIf="selectedDates['minimal']">
|
|
113
|
-
<strong>Selected:</strong>
|
|
114
|
-
<pre>{{ selectedDates['minimal'] | json }}</pre>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
|
|
118
|
-
<!-- Example 7: Date Range with minDate and maxDate -->
|
|
119
|
-
<div class="demo-card">
|
|
120
|
-
<h2>Date Range (Last 30 Days)</h2>
|
|
121
|
-
<hijri-date-picker
|
|
122
|
-
[mode]="'greg'"
|
|
123
|
-
[locale]="'en'"
|
|
124
|
-
[minDate]="minDate"
|
|
125
|
-
[maxDate]="maxDate"
|
|
126
|
-
[futureValidation]="false"
|
|
127
|
-
(dateSelected)="onDateSelected($event, 'range')">
|
|
128
|
-
</hijri-date-picker>
|
|
129
|
-
<div class="output" *ngIf="selectedDates['range']">
|
|
130
|
-
<strong>Selected:</strong>
|
|
131
|
-
<pre>{{ selectedDates['range'] | json }}</pre>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
|
|
135
|
-
<!-- Example 8: Future Dates Only with minDate -->
|
|
136
|
-
<div class="demo-card">
|
|
137
|
-
<h2>Future Dates Only (Next 60 Days)</h2>
|
|
138
|
-
<hijri-date-picker
|
|
139
|
-
[mode]="'greg'"
|
|
140
|
-
[locale]="'en'"
|
|
141
|
-
[minDate]="today"
|
|
142
|
-
[maxDate]="maxFutureDate"
|
|
143
|
-
[futureValidation]="false"
|
|
144
|
-
[todaysDateText]="'Select Today or Future'"
|
|
145
|
-
(dateSelected)="onDateSelected($event, 'futureOnly')">
|
|
146
|
-
</hijri-date-picker>
|
|
147
|
-
<div class="output" *ngIf="selectedDates['futureOnly']">
|
|
148
|
-
<strong>Selected:</strong>
|
|
149
|
-
<pre>{{ selectedDates['futureOnly'] | json }}</pre>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
`,
|
|
155
|
-
styles: [`
|
|
156
|
-
.demo-container {
|
|
157
|
-
max-width: 1400px;
|
|
158
|
-
margin: 0 auto;
|
|
159
|
-
padding: 40px 20px;
|
|
160
|
-
font-family: system-ui, -apple-system, sans-serif;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
h1 {
|
|
164
|
-
text-align: center;
|
|
165
|
-
color: #1f2937;
|
|
166
|
-
margin-bottom: 40px;
|
|
167
|
-
font-size: 2.5rem;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.demo-grid {
|
|
171
|
-
display: grid;
|
|
172
|
-
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
|
173
|
-
gap: 30px;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.demo-card {
|
|
177
|
-
background: white;
|
|
178
|
-
border-radius: 12px;
|
|
179
|
-
padding: 24px;
|
|
180
|
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.demo-card h2 {
|
|
184
|
-
margin-top: 0;
|
|
185
|
-
margin-bottom: 20px;
|
|
186
|
-
color: #374151;
|
|
187
|
-
font-size: 1.25rem;
|
|
188
|
-
border-bottom: 2px solid #e5e7eb;
|
|
189
|
-
padding-bottom: 10px;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.output {
|
|
193
|
-
margin-top: 20px;
|
|
194
|
-
padding: 16px;
|
|
195
|
-
background: #f9fafb;
|
|
196
|
-
border-radius: 8px;
|
|
197
|
-
border: 1px solid #e5e7eb;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.output strong {
|
|
201
|
-
display: block;
|
|
202
|
-
margin-bottom: 8px;
|
|
203
|
-
color: #374151;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.output pre {
|
|
207
|
-
margin: 0;
|
|
208
|
-
font-size: 12px;
|
|
209
|
-
color: #6b7280;
|
|
210
|
-
white-space: pre-wrap;
|
|
211
|
-
word-wrap: break-word;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
@media (max-width: 768px) {
|
|
215
|
-
.demo-grid {
|
|
216
|
-
grid-template-columns: 1fr;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
`]
|
|
220
|
-
})
|
|
221
|
-
export class DemoComponent {
|
|
222
|
-
selectedDates: { [key: string]: any } = {};
|
|
223
|
-
|
|
224
|
-
// Date range examples
|
|
225
|
-
today: Date = new Date();
|
|
226
|
-
minDate: Date = new Date(new Date().setDate(new Date().getDate() - 30)); // 30 days ago
|
|
227
|
-
maxDate: Date = new Date(); // Today
|
|
228
|
-
maxFutureDate: Date = new Date(new Date().setDate(new Date().getDate() + 60)); // 60 days from now
|
|
229
|
-
|
|
230
|
-
customStyles: DatePickerStyles = {
|
|
231
|
-
primaryColor: '#059669',
|
|
232
|
-
secondaryColor: '#34d399',
|
|
233
|
-
selectedDateBackground: '#059669',
|
|
234
|
-
todayColor: '#f59e0b',
|
|
235
|
-
borderRadius: '12px',
|
|
236
|
-
fontFamily: 'Inter, sans-serif'
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
onDateSelected(date: SelectedDate | SelectedDate[], key: string) {
|
|
240
|
-
this.selectedDates[key] = date;
|
|
241
|
-
console.log(`Date selected for ${key}:`, date);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// Bootstrap the demo application
|
|
246
|
-
bootstrapApplication(DemoComponent);
|
package/src/index.ts
DELETED