angular-hijri-gregorian-date-time-picker 1.5.0 → 1.5.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 +249 -236
- package/{fesm2020 → fesm2022}/angular-hijri-gregorian-date-time-picker.mjs +1438 -1438
- package/fesm2022/angular-hijri-gregorian-date-time-picker.mjs.map +1 -0
- package/index.d.ts +347 -5
- package/package.json +7 -15
- package/_interfaces/calendar-model.d.ts +0 -28
- package/_interfaces/styles-config.model.d.ts +0 -13
- package/_services/date-utilities.service.d.ts +0 -49
- package/esm2020/_data/dictionary.json +0 -1
- package/esm2020/_interfaces/calendar-model.mjs +0 -2
- package/esm2020/_interfaces/styles-config.model.mjs +0 -2
- package/esm2020/_services/date-utilities.service.mjs +0 -375
- package/esm2020/angular-hijri-gregorian-date-time-picker.mjs +0 -5
- package/esm2020/lib/hijri-gregorian-datepicker.component.mjs +0 -1058
- package/esm2020/lib/hijri-gregorian-datepicker.module.mjs +0 -19
- package/esm2020/public-api.mjs +0 -8
- package/esm2020/themes/themes.json +0 -152
- package/fesm2015/angular-hijri-gregorian-date-time-picker.mjs +0 -28995
- package/fesm2015/angular-hijri-gregorian-date-time-picker.mjs.map +0 -1
- package/fesm2020/angular-hijri-gregorian-date-time-picker.mjs.map +0 -1
- package/lib/hijri-gregorian-datepicker.component.d.ts +0 -238
- package/lib/hijri-gregorian-datepicker.module.d.ts +0 -9
- package/public-api.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,236 +1,249 @@
|
|
|
1
|
-
# Angular Hijri Gregorian
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/angular-hijri-gregorian-date-time-picker)
|
|
4
|
-
[](https://www.npmjs.com/package/angular-hijri-gregorian-date-time-picker)
|
|
4
|
+
[](https://www.npmjs.com/package/angular-hijri-gregorian-date-time-picker)
|
|
5
|
+
[](https://www.npmjs.com/package/angular-hijri-gregorian-date-time-picker)
|
|
6
|
+
[](https://www.npmjs.com/package/angular-hijri-gregorian-date-time-picker)
|
|
7
|
+
|
|
8
|
+
- Most accurate Hijri, Gregorian calendar(date-picker) on NPM with 100% accuracy percentage.
|
|
9
|
+
- Robust and tested code angular hijri/gregorian calendar/date-picker component for Angular 10 - 20+ projects.
|
|
10
|
+
- Ionic 3 - 4, 5, 6 + is supported, can be used in iOS and Android.
|
|
11
|
+
- `Zero` npm dependents package.
|
|
12
|
+
- 10 different `themes` and `layouts` already built in, you can also customize your own as well.
|
|
13
|
+
- **NEW:** Time picker with 12h/24h formats, Range selection, Beautiful custom selects, Bilingual typography
|
|
14
|
+
|
|
15
|
+
## Preview
|
|
16
|
+
|
|
17
|
+
<p>
|
|
18
|
+
<img src="https://github.com/hanygamal72/angular-hijri-gregorian-date-time-picker/blob/master/src/assets/imgs/themes_en.gif" width="40%"/>
|
|
19
|
+
<img src="https://github.com/hanygamal72/angular-hijri-gregorian-date-time-picker/blob/master/src/assets/imgs/themes_ar.gif" width="40%"/>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
## ✨ What's New in v1.5.0
|
|
23
|
+
|
|
24
|
+
### 🎉 Major Features
|
|
25
|
+
- **⏰ Time Picker** - Full time selection with 12-hour/24-hour format support
|
|
26
|
+
- **📅 Range Selection** - Select date ranges with start and end dates
|
|
27
|
+
- **🎨 Beautiful Custom Selects** - Modern dropdown menus with smooth animations and Remix Icons
|
|
28
|
+
- **🌐 Bilingual Typography** - Google Fonts integration (Poppins for English, Zain for Arabic)
|
|
29
|
+
- **🎯 Initial Date Support** - Pre-select dates/ranges when calendar loads (`initialDate`, `initialRangeStart`, `initialRangeEnd`)
|
|
30
|
+
|
|
31
|
+
### 🚀 UI/UX Enhancements
|
|
32
|
+
- Redesigned year/month selectors with professional styling
|
|
33
|
+
- Enhanced RTL/LTR support with automatic font switching
|
|
34
|
+
- Improved accessibility with proper ARIA labels
|
|
35
|
+
- Smooth animations and transitions throughout
|
|
36
|
+
- Better mobile responsiveness
|
|
37
|
+
|
|
38
|
+
[See full CHANGELOG](https://github.com/hanygamal72/angular-hijri-gregorian-date-time-picker/blob/master/projects/hijri-gregorian-datepicker/CHANGELOG.md)
|
|
39
|
+
|
|
40
|
+
<br />
|
|
41
|
+
|
|
42
|
+
## Background
|
|
43
|
+
|
|
44
|
+
The Umm Al-Qura calendar is the lunar Hijri calendar officially adopted by Saudi Arabia for administrative purposes. It was originated from Umm Al-Qura newspaper, the official newspaper of government of Saudi Arabia. The newspaper is published weekly and its first issue was on Friday, 15 Jumada al-Ula 1343 AH (12 December 1924 CE). However, the calendar has been printed and distributed separately by the Saudi government since 1346 AH (1927 CE).
|
|
45
|
+
|
|
46
|
+
The calendar is widely used in Saudi Arabia, especially by the public sector. Official documents, political letters, health care records, and education certificates, are just examples of many other documents that are dated by the Hijri calendar.
|
|
47
|
+
|
|
48
|
+
However, the Gregorian calendar is the calendar used in most of the world, and it has been implemented as the default calendar in nearly every computer and database.
|
|
49
|
+
|
|
50
|
+
<b> Star it to inspire us to build the best component! </b>
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- Can be used as a calendar or a datepicker with **time selection**.
|
|
55
|
+
- **RTL** and **LTR** support with **bilingual typography** (Poppins for English, Zain for Arabic)
|
|
56
|
+
- Easy to switch between **Gregorian** and **Hijri** calendars.
|
|
57
|
+
- Ability to specify the default calendar type either **Gregorian** or **Hijri**.
|
|
58
|
+
- Converting dates when changing type of calendar.
|
|
59
|
+
- Ability to specify min and max value for **Gregorian** and **Hijri**.
|
|
60
|
+
- Ability to make it required or readonly.
|
|
61
|
+
- Very easy to customize with **beautiful custom select dropdowns**.
|
|
62
|
+
- Can select **Single**, **Multiple** dates, or **Date Ranges**.
|
|
63
|
+
- **Time picker** with 12-hour/24-hour format support.
|
|
64
|
+
- **Initial date** and **initial range** support for pre-selecting dates.
|
|
65
|
+
- **Event listeners** for all datepicker events.
|
|
66
|
+
- Can customize future and past years number.
|
|
67
|
+
- **Responsive** design for web and mobile.
|
|
68
|
+
- **Modern UI** with Remix Icons and smooth animations.
|
|
69
|
+
- **Responsive** desing for web and mobile.
|
|
70
|
+
|
|
71
|
+
## Supported platforms
|
|
72
|
+
|
|
73
|
+
<b>Angular</b> 10 - 16, 18 +<br />
|
|
74
|
+
<b>Ionic</b> 3 - 4, 5, 6 +<br />
|
|
75
|
+
Mobile browsers and WebViews on: <b>Android</b> and <b>iOS</b><br />
|
|
76
|
+
Desktop browsers: <b>Chrome, Firefox, Safari, Edge v.79 +</b><br />
|
|
77
|
+
Other browsers: <b>Edge v.41 - 44</b> (without code hidden feature)
|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
$ npm install angular-hijri-gregorian-date-time-picker
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
Import `HijriGregorianDatepickerModule` in your app module or page module:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { HijriGregorianDatepickerModule } from 'angular-hijri-gregorian-date-time-picker';
|
|
89
|
+
|
|
90
|
+
@NgModule({
|
|
91
|
+
imports: [
|
|
92
|
+
// ...
|
|
93
|
+
HijriGregorianDatepickerModule
|
|
94
|
+
]
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<hijri-gregorian-datepicker
|
|
100
|
+
[canChangeMode]="true"
|
|
101
|
+
[todaysDateSection]="true"
|
|
102
|
+
[futureValidation]="true"
|
|
103
|
+
[disableYearPicker]="false"
|
|
104
|
+
[disableMonthPicker]="false"
|
|
105
|
+
[disableDayPicker]="false"
|
|
106
|
+
[isRequired]="false"
|
|
107
|
+
[showConfirmButton]="true"
|
|
108
|
+
[markToday]="true"
|
|
109
|
+
[mode]="'greg'"
|
|
110
|
+
[dir]="'ltr'"
|
|
111
|
+
[locale]="'en'"
|
|
112
|
+
[submitTextButton]="'Confirm'"
|
|
113
|
+
[todaysDateText]="'Today\'s Date'"
|
|
114
|
+
[ummAlQuraDateText]="'التاريخ الهجرى'"
|
|
115
|
+
[yearSelectLabel]="'Year'"
|
|
116
|
+
[monthSelectLabel]="'Month'"
|
|
117
|
+
[futureValidationMessageEn]="'Selected date cannot be in the future!'"
|
|
118
|
+
[futureValidationMessageAr]="
|
|
119
|
+
'التاريخ المحدد لا يمكن ان يكون في المستقبل!'
|
|
120
|
+
"
|
|
121
|
+
[pastYearsLimit]="90"
|
|
122
|
+
[futureYearsLimit]="0"
|
|
123
|
+
[theme]="'Midnight Blue'"
|
|
124
|
+
[styles]="stylesConfig"
|
|
125
|
+
(onSubmit)="onSubmit($event)"
|
|
126
|
+
(onDaySelect)="onChange($event)"
|
|
127
|
+
(onMonthChange)="onMonthChangeTest($event)"
|
|
128
|
+
(onYearChange)="onYearChangeTest($event)"
|
|
129
|
+
></hijri-gregorian-datepicker>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Inside your component.ts:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
// this called every time when user confirms a selected date
|
|
136
|
+
onSubmitEvent(code: string) {
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// this called only every time the use selects a date
|
|
140
|
+
onChangeEvent(code: string) {
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// this called every time the month value channges
|
|
144
|
+
onMonthChangeEvent(code: string) {
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// this called every time the year value channges
|
|
148
|
+
onYearChangeEvent(code: string) {
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## @Inputs()
|
|
153
|
+
|
|
154
|
+
| Property | Type | Default | Description |
|
|
155
|
+
| ---------------------------------- | :-----: | :-------------------------------------------: | ---------------------------------------------------------------------------------------------------------------- |
|
|
156
|
+
| <b>`canChangeMode`</b> | boolean | `true` | When `true` the user can toggle calendar modes, if `false` the user has only one calendar mode |
|
|
157
|
+
| <b>`todaysDateSection`</b> | boolean | `true` | When `true` the section with current today date will be shown, if `false` it will be hidden |
|
|
158
|
+
| <b>`futureValidation`</b> | boolean | `true` | When `true` the user cannot choose any future dates, if `false` user can select future dates |
|
|
159
|
+
| <b>`disableYearPicker`</b> | boolean | `false` | When `true` the user cannot select different years, if `false` year select will be enabled |
|
|
160
|
+
| <b>`disableMonthPicker`</b> | boolean | `false` | When `true` the user cannot select different months, if `false` month select will be enabled |
|
|
161
|
+
| <b>`disableDayPicker`</b> | boolean | `false` | When `true` the user cannot select days, if `false` days select will be enabled |
|
|
162
|
+
| <b>`isRequired`</b> | boolean | `true` | When `true` the confirm button will be disabled until user selects a date, if `false` the button will be enabled |
|
|
163
|
+
| <b>`showConfirmButton`</b> | boolean | `true` | When `true` the confirm button will be displayed, if `false` it will be hidden |
|
|
164
|
+
| <b>`markToday`</b> | boolean | `true` | When `true` today date will be marked(bordered), if `false` it will not be marked |
|
|
165
|
+
| <b>`mode`</b> | string | `greg` | Calendar mode, either `ummAlQura` or `greg` |
|
|
166
|
+
| <b>`dir`</b> | string | `ltr` | Layout direction, either `ltr` or `rtl` |
|
|
167
|
+
| <b>`locale`</b> | string | `en` | The language of the calendar layout, either `ar` or `en` |
|
|
168
|
+
| <b>`submitTextButton`</b> | string | `Confirm` | Confirm button text value |
|
|
169
|
+
| <b>`todaysDateText`</b> | string | `Todays\'s Date` | Today's date text in `todaysDateSection` |
|
|
170
|
+
| <b>`ummAlQuraDateText`</b> | string | `التاريخ الهجرى` | Text next to checkbox to toggle date `todaysDateSection` |
|
|
171
|
+
| <b>`yearSelectLabel`</b> | string | `Year` | Label of the year select option |
|
|
172
|
+
| <b>`monthSelectLabel`</b> | string | `Month` | Label of the month select option |
|
|
173
|
+
| <b>`futureValidationMessageEn`</b> | string | `Selected date cannot be in the future!` | English future validation message if `futureValidation` is set to `true` |
|
|
174
|
+
| <b>`futureValidationMessageAr`</b> | string | `التاريخ المحدد لا يمكن ان يكون في المستقبل!` | Arabic future validation message if `futureValidation` is set to `true` |
|
|
175
|
+
| <b>`pastYearsLimit`</b> | number | `90` | indicates for the past years number you want to allow user to select from |
|
|
176
|
+
| <b>`futureYearsLimit`</b> | number | `0` | indicates for the future years number you want to allow user to select from |
|
|
177
|
+
| <b>`selectionMode`</b> | string | `single` | Date selection mode, either `single` for single date selection or `range` for date range selection |
|
|
178
|
+
| <b>`initialDate`</b> | Date | `null` | Initial date to be selected/highlighted when calendar opens (for single selection mode) |
|
|
179
|
+
| <b>`initialRangeStart`</b> | Date | `null` | Initial start date for range selection (for range selection mode) |
|
|
180
|
+
| <b>`initialRangeEnd`</b> | Date | `null` | Initial end date for range selection (for range selection mode) |
|
|
181
|
+
| <b>`minDate`</b> | Date | `null` | Minimum selectable date - dates before this will be disabled |
|
|
182
|
+
| <b>`maxDate`</b> | Date | `null` | Maximum selectable date - dates after this will be disabled |
|
|
183
|
+
| <b>`useMeridian`</b> | boolean | `true` | When `true` the time picker uses 12-hour format with AM/PM, if `false` uses 24-hour format |
|
|
184
|
+
| <b>`styles`</b> | object | `{}` | Styles for the calendar look and feel |
|
|
185
|
+
| <b>`theme`</b> | string | `Midnight Blue` | Different skins and themes for the calendar('Ocean Breeze', 'Lavender Dreams', 'Sunset Glow', 'Midnight Blue', 'Forest Canopy', 'Rosewood Elegance', 'Icy Mint', 'Golden Sand', 'Steel Grey', 'Coral Reef'), and it has priority over styles
|
|
186
|
+
|
|
187
|
+
## Styles
|
|
188
|
+
|
|
189
|
+
| Property | Type | Default | Description |
|
|
190
|
+
| ---------------------------- | :----: | :---------------: | -------------------------------------------------------------------- |
|
|
191
|
+
| <b>`backgroundColor`</b> | string | `#E3F6F5` | Background of the calendar |
|
|
192
|
+
| <b>`primaryColor`</b> | string | `#272343` | Color of the today's date, year and month texts |
|
|
193
|
+
| <b>`secondaryColor`</b> | string | `#272343` | Background of submit button and selected days in calendar |
|
|
194
|
+
| <b>`todaysDateBgColor`</b> | string | `#272343` | Background of "today's date" date section |
|
|
195
|
+
| <b>`todaysDateTextColor`</b> | string | `#fff` | Color of "today's date" date section text |
|
|
196
|
+
| <b>`confirmBtnTextColor`</b> | string | `#fff` | Color of "Confirm" button text |
|
|
197
|
+
| <b>`disabledDayColor`</b> | string | `#C0C0C0` | Disabled days text color |
|
|
198
|
+
| <b>`dayNameColor`</b> | string | `#0d7f91` | Day names text color |
|
|
199
|
+
| <b>`dayColor`</b> | string | `#000` | Enabled days text color |
|
|
200
|
+
| <b>`fontFamily`</b> | string | `Default-Regular` | Font family of the font used globally and pre defined within project |
|
|
201
|
+
| <b>`borderRadius`</b> | string | `8px` | Border radius of the each div and button in the calendar layout |
|
|
202
|
+
| <b>`timePickerBgColor`</b> | string | `#ffffff` | Background color for time input fields |
|
|
203
|
+
| <b>`timePickerTextColor`</b> | string | `#333` | Text color for time display |
|
|
204
|
+
| <b>`timePickerBorderColor`</b> | string | `#ddd` | Border color for time inputs |
|
|
205
|
+
| <b>`timePickerArrowColor`</b> | string | `#5b479c` | Color for up/down arrow icons |
|
|
206
|
+
| <b>`timePickerColonColor`</b> | string | `#5b479c` | Color for colon separator |
|
|
207
|
+
| <b>`meridianBgColor`</b> | string | `#ffffff` | Background color for AM/PM buttons |
|
|
208
|
+
| <b>`meridianTextColor`</b> | string | `#666` | Text color for AM/PM buttons |
|
|
209
|
+
| <b>`meridianActiveBgColor`</b> | string | `rgb(0, 77, 97)` | Background color for active AM/PM button |
|
|
210
|
+
| <b>`meridianActiveTextColor`</b> | string | `#ffffff` | Text color for active AM/PM button |
|
|
211
|
+
|
|
212
|
+
## @Outputs()
|
|
213
|
+
|
|
214
|
+
| Output | Description |
|
|
215
|
+
| --------------- | ------------------------------------------------------------- |
|
|
216
|
+
| `onSubmit` | Will be called every time when a user submits a selected date |
|
|
217
|
+
| `onDaySelect` | Will be called every time when a user selects new date |
|
|
218
|
+
| `onMonthChange` | Will be called every time the month value changes |
|
|
219
|
+
| `onYearChange` | Will be called every time the year value changes |
|
|
220
|
+
|
|
221
|
+
## Helper Functions
|
|
222
|
+
|
|
223
|
+
import { DateUtilitiesService } from '../_services/date-utilities.service';
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
constructor(private _dateUtils: DateUtilitiesService) {
|
|
227
|
+
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
| Output | Description |
|
|
233
|
+
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
234
|
+
| <b>`convertDate`</b> | Converts dates from Gregorian to Umm Al Qura and vice versa |
|
|
235
|
+
| <b>`checkPastOrFuture`</b> | Checks date whether it's future or past date('Future', 'Past', 'Today') |
|
|
236
|
+
| <b>`formatDate`</b> | Converts date from human-readable string representation(ex. Mon Sep 05 2023 15:30:45 GMT+0200) to separated "/" string(ex. 05/09/2023) |
|
|
237
|
+
| <b>`parseDate`</b> | The opposite of `formateDate` function |
|
|
238
|
+
| <b>`getGregorianMonthData`</b> | Generates an array of objects of Gregorian month passed to it |
|
|
239
|
+
| <b>`getUmAlQurraMonthData`</b> | Generates an array of objects of Umm Al Qura month passed to it |
|
|
240
|
+
|
|
241
|
+
## Contributing
|
|
242
|
+
|
|
243
|
+
Contributions are more than welcome!
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
MIT License
|
|
248
|
+
|
|
249
|
+
Copyright (c) 2022 Muhammad Hanafi, Imad Khan
|