hijri-date-time-picker 1.0.0 → 1.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/LICENSE +21 -21
- package/README.md +185 -183
- package/dist/LICENSE +21 -0
- package/dist/README.md +185 -0
- package/dist/demo.d.ts +5 -1
- package/dist/demo.js +213 -173
- package/dist/esm2022/hijri-date-time-picker.mjs +5 -0
- package/dist/esm2022/index.mjs +3 -0
- package/dist/esm2022/lib/hijri-date-picker.component.mjs +606 -0
- package/dist/esm2022/lib/hijri-date-picker.types.mjs +22 -0
- package/dist/fesm2022/hijri-date-time-picker.mjs +634 -0
- package/dist/fesm2022/hijri-date-time-picker.mjs.map +1 -0
- package/dist/lib/hijri-date-picker.component.d.ts +8 -6
- package/dist/lib/hijri-date-picker.component.js +245 -118
- package/dist/lib/hijri-date-picker.types.d.ts +4 -4
- package/dist/lib/hijri-date-picker.types.js +66 -10
- package/package.json +48 -47
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Hany
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hany
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,183 +1,185 @@
|
|
|
1
|
-
# Hijri Date Time Picker Component
|
|
2
|
-
|
|
3
|
-
An Angular standalone component for dual-mode Gregorian and Hijri date selection with time support using the Umm Al-Qura calendar system.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
✨ **Dual Calendar Support**: Switch between Gregorian and Hijri (Umm Al-Qura) calendars
|
|
8
|
-
🌍 **Localization**: Full support for English and Arabic languages
|
|
9
|
-
↔️ **RTL/LTR**: Automatic layout direction based on locale
|
|
10
|
-
📅 **Multiple Selection**: Single or multiple date selection modes
|
|
11
|
-
🕒 **DateTime Support**: Integrated time selection with modern styling
|
|
12
|
-
🎨 **Customizable Styling**: Comprehensive theming via CSS variables
|
|
13
|
-
✅ **Validation**: Future date validation with configurable limits
|
|
14
|
-
📱 **Responsive**: Mobile-friendly design
|
|
15
|
-
♿ **Accessible**: ARIA labels and keyboard navigation support
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install hijri-date-time-picker hijri-date
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Dependencies
|
|
24
|
-
|
|
25
|
-
- `@angular/core` >= 15.0.0
|
|
26
|
-
- `@angular/common` >= 15.0.0
|
|
27
|
-
- `hijri-date` ^0.2.2
|
|
28
|
-
|
|
29
|
-
## Usage
|
|
30
|
-
|
|
31
|
-
### Basic Example
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
import { Component } from '@angular/core';
|
|
35
|
-
import { HijriDatePickerComponent, SelectedDate } from 'hijri-date-time-picker';
|
|
36
|
-
|
|
37
|
-
@Component({
|
|
38
|
-
selector: 'app-root',
|
|
39
|
-
standalone: true,
|
|
40
|
-
imports: [HijriDatePickerComponent],
|
|
41
|
-
template: `
|
|
42
|
-
<hijri-date-picker
|
|
43
|
-
[mode]="'greg'"
|
|
44
|
-
[locale]="'en'"
|
|
45
|
-
(dateSelected)="onDateSelected($event)">
|
|
46
|
-
</hijri-date-picker>
|
|
47
|
-
`
|
|
48
|
-
})
|
|
49
|
-
export class AppComponent {
|
|
50
|
-
onDateSelected(date: SelectedDate) {
|
|
51
|
-
console.log('Selected date:', date);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### DateTime Picker Example
|
|
57
|
-
|
|
58
|
-
```html
|
|
59
|
-
<hijri-date-picker
|
|
60
|
-
[enableTime]="true"
|
|
61
|
-
[timeFormat]="'12'"
|
|
62
|
-
[minuteStep]="15"
|
|
63
|
-
[enableSeconds]="false"
|
|
64
|
-
(dateSelected)="onDateTimeSelected($event)">
|
|
65
|
-
</hijri-date-picker>
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Initial Date Binding
|
|
69
|
-
|
|
70
|
-
```html
|
|
71
|
-
<!-- Single Date Selection -->
|
|
72
|
-
<hijri-date-picker
|
|
73
|
-
[initialSelectedDate]="myDate">
|
|
74
|
-
</hijri-date-picker>
|
|
75
|
-
|
|
76
|
-
<!-- Multiple Dates Selection -->
|
|
77
|
-
<hijri-date-picker
|
|
78
|
-
[multiple]="true"
|
|
79
|
-
[initialSelectedDates]="myDates">
|
|
80
|
-
</hijri-date-picker>
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## API Reference
|
|
84
|
-
|
|
85
|
-
### Inputs
|
|
86
|
-
|
|
87
|
-
#### Mode & Configuration
|
|
88
|
-
|
|
89
|
-
| Input | Type | Default | Description |
|
|
90
|
-
|-------|------|---------|-------------|
|
|
91
|
-
| `canChangeMode` | `boolean` | `true` | Enable/disable mode toggle button |
|
|
92
|
-
| `mode` | `'greg' \| 'hijri'` | `'greg'` | Initial calendar mode |
|
|
93
|
-
| `dir` | `'ltr' \| 'rtl'` | `'ltr'` | Text direction |
|
|
94
|
-
| `locale` | `'en' \| 'ar'` | `'en'` | Language locale |
|
|
95
|
-
|
|
96
|
-
#### DateTime Configuration (NEW)
|
|
97
|
-
|
|
98
|
-
| Input | Type | Default | Description |
|
|
99
|
-
|-------|------|---------|-------------|
|
|
100
|
-
| `enableTime` | `boolean` | `false` | Enable time selection UI |
|
|
101
|
-
| `timeFormat` | `'12' \| '24'` | `'24'` | Time display format |
|
|
102
|
-
| `minuteStep` | `number` | `1` | Increment step for minutes |
|
|
103
|
-
| `enableSeconds` | `boolean` | `false` | Show seconds selection |
|
|
104
|
-
| `defaultTime` | `{ hours, minutes, seconds? }` | `undefined` | Default time to show |
|
|
105
|
-
|
|
106
|
-
#### Validation
|
|
107
|
-
|
|
108
|
-
| Input | Type | Default | Description |
|
|
109
|
-
|-------|------|---------|-------------|
|
|
110
|
-
| `futureValidation` | `boolean` | `true` | Prevent selecting dates beyond limit |
|
|
111
|
-
| `futureYearsLimit` | `number` | `10` | Maximum years in the future |
|
|
112
|
-
| `isRequired` | `boolean` | `false` | Require date selection before submit |
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
|
119
|
-
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
|
128
|
-
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
1
|
+
# Hijri Date Time Picker Component
|
|
2
|
+
|
|
3
|
+
An Angular standalone component for dual-mode Gregorian and Hijri date selection with time support using the Umm Al-Qura calendar system.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
✨ **Dual Calendar Support**: Switch between Gregorian and Hijri (Umm Al-Qura) calendars
|
|
8
|
+
🌍 **Localization**: Full support for English and Arabic languages
|
|
9
|
+
↔️ **RTL/LTR**: Automatic layout direction based on locale
|
|
10
|
+
📅 **Multiple Selection**: Single or multiple date selection modes
|
|
11
|
+
🕒 **DateTime Support**: Integrated time selection with modern styling
|
|
12
|
+
🎨 **Customizable Styling**: Comprehensive theming via CSS variables
|
|
13
|
+
✅ **Validation**: Future date validation with configurable limits
|
|
14
|
+
📱 **Responsive**: Mobile-friendly design
|
|
15
|
+
♿ **Accessible**: ARIA labels and keyboard navigation support
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install hijri-date-time-picker hijri-date
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Dependencies
|
|
24
|
+
|
|
25
|
+
- `@angular/core` >= 15.0.0
|
|
26
|
+
- `@angular/common` >= 15.0.0
|
|
27
|
+
- `hijri-date` ^0.2.2
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### Basic Example
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { Component } from '@angular/core';
|
|
35
|
+
import { HijriDatePickerComponent, SelectedDate } from 'hijri-date-time-picker';
|
|
36
|
+
|
|
37
|
+
@Component({
|
|
38
|
+
selector: 'app-root',
|
|
39
|
+
standalone: true,
|
|
40
|
+
imports: [HijriDatePickerComponent],
|
|
41
|
+
template: `
|
|
42
|
+
<hijri-date-picker
|
|
43
|
+
[mode]="'greg'"
|
|
44
|
+
[locale]="'en'"
|
|
45
|
+
(dateSelected)="onDateSelected($event)">
|
|
46
|
+
</hijri-date-picker>
|
|
47
|
+
`
|
|
48
|
+
})
|
|
49
|
+
export class AppComponent {
|
|
50
|
+
onDateSelected(date: SelectedDate) {
|
|
51
|
+
console.log('Selected date:', date);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### DateTime Picker Example
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<hijri-date-picker
|
|
60
|
+
[enableTime]="true"
|
|
61
|
+
[timeFormat]="'12'"
|
|
62
|
+
[minuteStep]="15"
|
|
63
|
+
[enableSeconds]="false"
|
|
64
|
+
(dateSelected)="onDateTimeSelected($event)">
|
|
65
|
+
</hijri-date-picker>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Initial Date Binding
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<!-- Single Date Selection -->
|
|
72
|
+
<hijri-date-picker
|
|
73
|
+
[initialSelectedDate]="myDate">
|
|
74
|
+
</hijri-date-picker>
|
|
75
|
+
|
|
76
|
+
<!-- Multiple Dates Selection -->
|
|
77
|
+
<hijri-date-picker
|
|
78
|
+
[multiple]="true"
|
|
79
|
+
[initialSelectedDates]="myDates">
|
|
80
|
+
</hijri-date-picker>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## API Reference
|
|
84
|
+
|
|
85
|
+
### Inputs
|
|
86
|
+
|
|
87
|
+
#### Mode & Configuration
|
|
88
|
+
|
|
89
|
+
| Input | Type | Default | Description |
|
|
90
|
+
|-------|------|---------|-------------|
|
|
91
|
+
| `canChangeMode` | `boolean` | `true` | Enable/disable mode toggle button |
|
|
92
|
+
| `mode` | `'greg' \| 'hijri'` | `'greg'` | Initial calendar mode |
|
|
93
|
+
| `dir` | `'ltr' \| 'rtl'` | `'ltr'` | Text direction |
|
|
94
|
+
| `locale` | `'en' \| 'ar'` | `'en'` | Language locale |
|
|
95
|
+
|
|
96
|
+
#### DateTime Configuration (NEW)
|
|
97
|
+
|
|
98
|
+
| Input | Type | Default | Description |
|
|
99
|
+
|-------|------|---------|-------------|
|
|
100
|
+
| `enableTime` | `boolean` | `false` | Enable time selection UI |
|
|
101
|
+
| `timeFormat` | `'12' \| '24'` | `'24'` | Time display format |
|
|
102
|
+
| `minuteStep` | `number` | `1` | Increment step for minutes |
|
|
103
|
+
| `enableSeconds` | `boolean` | `false` | Show seconds selection |
|
|
104
|
+
| `defaultTime` | `{ hours, minutes, seconds? }` | `undefined` | Default time to show |
|
|
105
|
+
|
|
106
|
+
#### Validation
|
|
107
|
+
|
|
108
|
+
| Input | Type | Default | Description |
|
|
109
|
+
|-------|------|---------|-------------|
|
|
110
|
+
| `futureValidation` | `boolean` | `true` | Prevent selecting dates beyond limit |
|
|
111
|
+
| `futureYearsLimit` | `number` | `10` | Maximum years in the future |
|
|
112
|
+
| `isRequired` | `boolean` | `false` | Require date selection before submit |
|
|
113
|
+
| `minDate` | `Date` | `undefined` | Minimum selectable date |
|
|
114
|
+
| `maxDate` | `Date` | `undefined` | Maximum selectable date |
|
|
115
|
+
|
|
116
|
+
#### Selection & Binding
|
|
117
|
+
|
|
118
|
+
| Input | Type | Default | Description |
|
|
119
|
+
|-------|------|---------|-------------|
|
|
120
|
+
| `multiple` | `boolean` | `false` | Enable multiple date selection |
|
|
121
|
+
| `showConfirmButton` | `boolean` | `false` | Show submit button |
|
|
122
|
+
| `initialSelectedDate` | `Date` | `undefined` | Pre-select a single date |
|
|
123
|
+
| `initialSelectedDates` | `Date[]` | `[]` | Pre-select multiple dates |
|
|
124
|
+
|
|
125
|
+
#### Labels
|
|
126
|
+
|
|
127
|
+
| Input | Type | Default | Description |
|
|
128
|
+
|-------|------|---------|-------------|
|
|
129
|
+
| `submitTextButton` | `string` | `'Submit'` | Submit button text |
|
|
130
|
+
| `todaysDateText` | `string` | `'Today'` | Today button text |
|
|
131
|
+
| `ummAlQuraDateText` | `string` | `'Umm Al-Qura Calendar'` | Calendar type label |
|
|
132
|
+
| `yearSelectLabel` | `string` | `'Year'` | Year dropdown label |
|
|
133
|
+
| `monthSelectLabel` | `string` | `'Month'` | Month dropdown label |
|
|
134
|
+
|
|
135
|
+
### Outputs
|
|
136
|
+
|
|
137
|
+
| Output | Type | Description |
|
|
138
|
+
|--------|------|-------------|
|
|
139
|
+
| `dateSelected` | `EventEmitter<SelectedDate \| SelectedDate[]>` | Emits when date(s) selected |
|
|
140
|
+
| `modeChanged` | `EventEmitter<'greg' \| 'hijri'>` | Emits when calendar mode changes |
|
|
141
|
+
|
|
142
|
+
### Types
|
|
143
|
+
|
|
144
|
+
#### SelectedDate
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
interface SelectedDate {
|
|
148
|
+
gregorian: Date;
|
|
149
|
+
hijri: {
|
|
150
|
+
year: number;
|
|
151
|
+
month: number;
|
|
152
|
+
day: number;
|
|
153
|
+
};
|
|
154
|
+
time?: {
|
|
155
|
+
hours: number;
|
|
156
|
+
minutes: number;
|
|
157
|
+
seconds: number;
|
|
158
|
+
};
|
|
159
|
+
formatted: {
|
|
160
|
+
gregorian: string;
|
|
161
|
+
hijri: string;
|
|
162
|
+
time?: string;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Styling
|
|
168
|
+
|
|
169
|
+
The component can be customized using the `styles` input or by overriding CSS variables:
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
const customStyles: DatePickerStyles = {
|
|
173
|
+
primaryColor: '#4f46e5',
|
|
174
|
+
secondaryColor: '#818cf8',
|
|
175
|
+
borderRadius: '8px'
|
|
176
|
+
};
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
MIT
|
|
182
|
+
|
|
183
|
+
## Credits
|
|
184
|
+
|
|
185
|
+
Built with [Angular](https://angular.io/) and [hijri-date](https://www.npmjs.com/package/hijri-date).
|
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hany
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Hijri Date Time Picker Component
|
|
2
|
+
|
|
3
|
+
An Angular standalone component for dual-mode Gregorian and Hijri date selection with time support using the Umm Al-Qura calendar system.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
✨ **Dual Calendar Support**: Switch between Gregorian and Hijri (Umm Al-Qura) calendars
|
|
8
|
+
🌍 **Localization**: Full support for English and Arabic languages
|
|
9
|
+
↔️ **RTL/LTR**: Automatic layout direction based on locale
|
|
10
|
+
📅 **Multiple Selection**: Single or multiple date selection modes
|
|
11
|
+
🕒 **DateTime Support**: Integrated time selection with modern styling
|
|
12
|
+
🎨 **Customizable Styling**: Comprehensive theming via CSS variables
|
|
13
|
+
✅ **Validation**: Future date validation with configurable limits
|
|
14
|
+
📱 **Responsive**: Mobile-friendly design
|
|
15
|
+
♿ **Accessible**: ARIA labels and keyboard navigation support
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install hijri-date-time-picker hijri-date
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Dependencies
|
|
24
|
+
|
|
25
|
+
- `@angular/core` >= 15.0.0
|
|
26
|
+
- `@angular/common` >= 15.0.0
|
|
27
|
+
- `hijri-date` ^0.2.2
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### Basic Example
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { Component } from '@angular/core';
|
|
35
|
+
import { HijriDatePickerComponent, SelectedDate } from 'hijri-date-time-picker';
|
|
36
|
+
|
|
37
|
+
@Component({
|
|
38
|
+
selector: 'app-root',
|
|
39
|
+
standalone: true,
|
|
40
|
+
imports: [HijriDatePickerComponent],
|
|
41
|
+
template: `
|
|
42
|
+
<hijri-date-picker
|
|
43
|
+
[mode]="'greg'"
|
|
44
|
+
[locale]="'en'"
|
|
45
|
+
(dateSelected)="onDateSelected($event)">
|
|
46
|
+
</hijri-date-picker>
|
|
47
|
+
`
|
|
48
|
+
})
|
|
49
|
+
export class AppComponent {
|
|
50
|
+
onDateSelected(date: SelectedDate) {
|
|
51
|
+
console.log('Selected date:', date);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### DateTime Picker Example
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<hijri-date-picker
|
|
60
|
+
[enableTime]="true"
|
|
61
|
+
[timeFormat]="'12'"
|
|
62
|
+
[minuteStep]="15"
|
|
63
|
+
[enableSeconds]="false"
|
|
64
|
+
(dateSelected)="onDateTimeSelected($event)">
|
|
65
|
+
</hijri-date-picker>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Initial Date Binding
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<!-- Single Date Selection -->
|
|
72
|
+
<hijri-date-picker
|
|
73
|
+
[initialSelectedDate]="myDate">
|
|
74
|
+
</hijri-date-picker>
|
|
75
|
+
|
|
76
|
+
<!-- Multiple Dates Selection -->
|
|
77
|
+
<hijri-date-picker
|
|
78
|
+
[multiple]="true"
|
|
79
|
+
[initialSelectedDates]="myDates">
|
|
80
|
+
</hijri-date-picker>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## API Reference
|
|
84
|
+
|
|
85
|
+
### Inputs
|
|
86
|
+
|
|
87
|
+
#### Mode & Configuration
|
|
88
|
+
|
|
89
|
+
| Input | Type | Default | Description |
|
|
90
|
+
|-------|------|---------|-------------|
|
|
91
|
+
| `canChangeMode` | `boolean` | `true` | Enable/disable mode toggle button |
|
|
92
|
+
| `mode` | `'greg' \| 'hijri'` | `'greg'` | Initial calendar mode |
|
|
93
|
+
| `dir` | `'ltr' \| 'rtl'` | `'ltr'` | Text direction |
|
|
94
|
+
| `locale` | `'en' \| 'ar'` | `'en'` | Language locale |
|
|
95
|
+
|
|
96
|
+
#### DateTime Configuration (NEW)
|
|
97
|
+
|
|
98
|
+
| Input | Type | Default | Description |
|
|
99
|
+
|-------|------|---------|-------------|
|
|
100
|
+
| `enableTime` | `boolean` | `false` | Enable time selection UI |
|
|
101
|
+
| `timeFormat` | `'12' \| '24'` | `'24'` | Time display format |
|
|
102
|
+
| `minuteStep` | `number` | `1` | Increment step for minutes |
|
|
103
|
+
| `enableSeconds` | `boolean` | `false` | Show seconds selection |
|
|
104
|
+
| `defaultTime` | `{ hours, minutes, seconds? }` | `undefined` | Default time to show |
|
|
105
|
+
|
|
106
|
+
#### Validation
|
|
107
|
+
|
|
108
|
+
| Input | Type | Default | Description |
|
|
109
|
+
|-------|------|---------|-------------|
|
|
110
|
+
| `futureValidation` | `boolean` | `true` | Prevent selecting dates beyond limit |
|
|
111
|
+
| `futureYearsLimit` | `number` | `10` | Maximum years in the future |
|
|
112
|
+
| `isRequired` | `boolean` | `false` | Require date selection before submit |
|
|
113
|
+
| `minDate` | `Date` | `undefined` | Minimum selectable date (dates before are disabled) |
|
|
114
|
+
| `maxDate` | `Date` | `undefined` | Maximum selectable date (dates after are disabled) |
|
|
115
|
+
|
|
116
|
+
#### Selection & Binding
|
|
117
|
+
|
|
118
|
+
| Input | Type | Default | Description |
|
|
119
|
+
|-------|------|---------|-------------|
|
|
120
|
+
| `multiple` | `boolean` | `false` | Enable multiple date selection |
|
|
121
|
+
| `showConfirmButton` | `boolean` | `false` | Show submit button |
|
|
122
|
+
| `initialSelectedDate` | `Date` | `undefined` | Pre-select a single date |
|
|
123
|
+
| `initialSelectedDates` | `Date[]` | `[]` | Pre-select multiple dates |
|
|
124
|
+
|
|
125
|
+
#### Labels
|
|
126
|
+
|
|
127
|
+
| Input | Type | Default | Description |
|
|
128
|
+
|-------|------|---------|-------------|
|
|
129
|
+
| `submitTextButton` | `string` | `'Submit'` | Submit button text |
|
|
130
|
+
| `todaysDateText` | `string` | `'Today'` | Today button text |
|
|
131
|
+
| `ummAlQuraDateText` | `string` | `'Umm Al-Qura Calendar'` | Calendar type label |
|
|
132
|
+
| `yearSelectLabel` | `string` | `'Year'` | Year dropdown label |
|
|
133
|
+
| `monthSelectLabel` | `string` | `'Month'` | Month dropdown label |
|
|
134
|
+
|
|
135
|
+
### Outputs
|
|
136
|
+
|
|
137
|
+
| Output | Type | Description |
|
|
138
|
+
|--------|------|-------------|
|
|
139
|
+
| `dateSelected` | `EventEmitter<SelectedDate \| SelectedDate[]>` | Emits when date(s) selected |
|
|
140
|
+
| `modeChanged` | `EventEmitter<'greg' \| 'hijri'>` | Emits when calendar mode changes |
|
|
141
|
+
|
|
142
|
+
### Types
|
|
143
|
+
|
|
144
|
+
#### SelectedDate
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
interface SelectedDate {
|
|
148
|
+
gregorian: Date;
|
|
149
|
+
hijri: {
|
|
150
|
+
year: number;
|
|
151
|
+
month: number;
|
|
152
|
+
day: number;
|
|
153
|
+
};
|
|
154
|
+
time?: {
|
|
155
|
+
hours: number;
|
|
156
|
+
minutes: number;
|
|
157
|
+
seconds: number;
|
|
158
|
+
};
|
|
159
|
+
formatted: {
|
|
160
|
+
gregorian: string;
|
|
161
|
+
hijri: string;
|
|
162
|
+
time?: string;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Styling
|
|
168
|
+
|
|
169
|
+
The component can be customized using the `styles` input or by overriding CSS variables:
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
const customStyles: DatePickerStyles = {
|
|
173
|
+
primaryColor: '#4f46e5',
|
|
174
|
+
secondaryColor: '#818cf8',
|
|
175
|
+
borderRadius: '8px'
|
|
176
|
+
};
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
MIT
|
|
182
|
+
|
|
183
|
+
## Credits
|
|
184
|
+
|
|
185
|
+
Built with [Angular](https://angular.io/) and [hijri-date](https://www.npmjs.com/package/hijri-date).
|
package/dist/demo.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { SelectedDate, DatePickerStyles } from './lib/hijri-date-picker.
|
|
1
|
+
import { SelectedDate, DatePickerStyles } from './lib/hijri-date-picker.types';
|
|
2
2
|
export declare class DemoComponent {
|
|
3
3
|
selectedDates: {
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
};
|
|
6
|
+
today: Date;
|
|
7
|
+
minDate: Date;
|
|
8
|
+
maxDate: Date;
|
|
9
|
+
maxFutureDate: Date;
|
|
6
10
|
customStyles: DatePickerStyles;
|
|
7
11
|
onDateSelected(date: SelectedDate | SelectedDate[], key: string): void;
|
|
8
12
|
}
|