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/index.d.ts CHANGED
@@ -1,5 +1,347 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="angular-hijri-gregorian-date-time-picker" />
5
- export * from './public-api';
1
+ import * as i0 from '@angular/core';
2
+ import { OnInit, OnChanges, AfterViewInit, EventEmitter, SimpleChanges } from '@angular/core';
3
+ import * as i2 from '@angular/forms';
4
+ import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
5
+ import * as i3 from '@angular/common';
6
+
7
+ interface MonthInfo {
8
+ fD: DayInfo;
9
+ lD: DayInfo;
10
+ }
11
+ interface YearData {
12
+ [month: string]: MonthInfo;
13
+ }
14
+ interface Data {
15
+ [year: string]: YearData;
16
+ }
17
+ interface TimeValue {
18
+ hour: number;
19
+ minute: number;
20
+ }
21
+ interface DayInfo {
22
+ gD: string;
23
+ uD: string;
24
+ dN: string;
25
+ uC: number;
26
+ selected?: boolean;
27
+ disabled?: boolean;
28
+ time?: TimeValue;
29
+ }
30
+ interface TodayDate {
31
+ gregorian?: string;
32
+ ummAlQura?: string;
33
+ }
34
+ type MonthDays = DayInfo[];
35
+
36
+ declare class DateUtilitiesService {
37
+ calendarData: Data;
38
+ constructor();
39
+ parseDate(dateStr: string): Date | null;
40
+ formatDate(date: Date): string;
41
+ getDayShortHand(date: Date): string;
42
+ generateDates(fD: DayInfo, lD: DayInfo, uC: number): MonthDays;
43
+ convertDate(dateStr: string, isGregorian: boolean): DayInfo | null;
44
+ private isDateInMonthRange;
45
+ getMonthData(inputDate: string, type: string): DayInfo[] | null;
46
+ getGregorianMonthData(day: number, month: number, year: number): DayInfo[] | null;
47
+ getUmAlQurraMonthData(day: number, month: number, year: number): DayInfo[] | null;
48
+ calculateGregorianDate(startGDate: string, offset: number): string;
49
+ calculateUmAlQurraDate(startUDate: string, offset: number, uC: number): string;
50
+ getDayName(dayIndex: number): string;
51
+ checkPastOrFuture(inputDate: any, targetDate: any): "Future" | "Past" | "Today";
52
+ parseEnglish(englishNum: any): any;
53
+ parseArabic(arabicNum: any): any;
54
+ convertDateNumerals(date: string, targetLang: 'en' | 'ar'): string;
55
+ /**
56
+ * Normalize input date to DD/MM/YYYY string format (Gregorian)
57
+ * Accepts Date object or DD/MM/YYYY string
58
+ */
59
+ normalizeDateToString(date: Date | string | undefined): string | null;
60
+ /**
61
+ * Compare two dates (Gregorian format DD/MM/YYYY)
62
+ * Returns: -1 if date1 < date2, 0 if equal, 1 if date1 > date2
63
+ */
64
+ compareDates(date1Str: string, date2Str: string): number;
65
+ /**
66
+ * Compare two Hijri dates (UM format DD/MM/YYYY)
67
+ * Converts to Gregorian for comparison
68
+ */
69
+ compareHijriDates(hijri1: string, hijri2: string): number;
70
+ /**
71
+ * Check if a date is within the specified range (inclusive)
72
+ * All dates in Gregorian DD/MM/YYYY format
73
+ */
74
+ isDateInRange(dateStr: string, minDateStr: string | null, maxDateStr: string | null): boolean;
75
+ /**
76
+ * Check if a Hijri date is within the specified range
77
+ * Converts to Gregorian for comparison
78
+ */
79
+ isHijriDateInRange(hijriDateStr: string, minDateStr: string | null, maxDateStr: string | null): boolean;
80
+ static ɵfac: i0.ɵɵFactoryDeclaration<DateUtilitiesService, never>;
81
+ static ɵprov: i0.ɵɵInjectableDeclaration<DateUtilitiesService>;
82
+ }
83
+
84
+ interface stylesConfig {
85
+ backgroundColor?: string;
86
+ primaryColor?: string;
87
+ secondaryColor?: string;
88
+ todaysDateBgColor?: string;
89
+ todaysDateTextColor?: string;
90
+ confirmBtnTextColor?: string;
91
+ disabledDayColor?: string;
92
+ dayNameColor?: string;
93
+ dayColor?: string;
94
+ fontFamily?: string;
95
+ borderRadius?: string;
96
+ timePickerBgColor?: string;
97
+ timePickerTextColor?: string;
98
+ timePickerBorderColor?: string;
99
+ timePickerArrowColor?: string;
100
+ timePickerColonColor?: string;
101
+ meridianBgColor?: string;
102
+ meridianTextColor?: string;
103
+ meridianActiveBgColor?: string;
104
+ meridianActiveTextColor?: string;
105
+ }
106
+
107
+ declare class HijriGregorianDatepickerComponent implements OnInit, OnChanges, AfterViewInit {
108
+ formBuilder: UntypedFormBuilder;
109
+ _dateUtilsService: DateUtilitiesService;
110
+ markToday: boolean;
111
+ canChangeMode: boolean;
112
+ todaysDateSection: boolean;
113
+ futureValidation: boolean;
114
+ disableYearPicker: boolean;
115
+ disableMonthPicker: boolean;
116
+ disableDayPicker: boolean;
117
+ multiple: boolean;
118
+ isRequired: boolean;
119
+ showConfirmButton: boolean;
120
+ futureValidationMessage: boolean;
121
+ arabicLayout: boolean;
122
+ mode: string;
123
+ dir: string;
124
+ locale: string;
125
+ submitTextButton: string;
126
+ todaysDateText: string;
127
+ ummAlQuraDateText: string;
128
+ monthSelectLabel: string;
129
+ yearSelectLabel: string;
130
+ futureValidationMessageEn: string;
131
+ futureValidationMessageAr: string;
132
+ theme?: string;
133
+ pastYearsLimit: number;
134
+ futureYearsLimit: number;
135
+ styles?: stylesConfig;
136
+ enableTime: boolean;
137
+ minDate?: Date | string;
138
+ maxDate?: Date | string;
139
+ initialDate?: Date | string;
140
+ initialRangeStart?: Date | string;
141
+ initialRangeEnd?: Date | string;
142
+ useMeridian: boolean;
143
+ selectionMode: 'single' | 'range';
144
+ onSubmit: EventEmitter<object>;
145
+ onDaySelect: EventEmitter<object>;
146
+ onMonthChange: EventEmitter<object>;
147
+ onYearChange: EventEmitter<object>;
148
+ ummAlQuraMonths: {
149
+ labelAr: string;
150
+ labelEn: string;
151
+ value: number;
152
+ }[];
153
+ gregMonths: {
154
+ labelAr: string;
155
+ labelEn: string;
156
+ value: number;
157
+ }[];
158
+ ummAlQuraYear: number;
159
+ gregYear: number;
160
+ years: any[];
161
+ weeks: any[];
162
+ months: any[];
163
+ weekdaysEn: string[];
164
+ weekdaysAr: string[];
165
+ todaysDate: TodayDate;
166
+ selectedDay: DayInfo;
167
+ periodForm: UntypedFormGroup;
168
+ multipleSelectedDates: DayInfo[];
169
+ themes: any;
170
+ selectedTime: {
171
+ hour: number;
172
+ minute: number;
173
+ };
174
+ private timeInitialized;
175
+ meridian: 'AM' | 'PM';
176
+ rangeStart?: DayInfo;
177
+ rangeEnd?: DayInfo;
178
+ fontFamilyStyle: string;
179
+ constructor(formBuilder: UntypedFormBuilder, _dateUtilsService: DateUtilitiesService);
180
+ ngOnInit(): void;
181
+ ngAfterViewInit(): void;
182
+ ngOnChanges(changes: SimpleChanges): void;
183
+ initTheme(): void;
184
+ initializeForm(): void;
185
+ initializeYearsAndMonths(): void;
186
+ onPeriodChange(type: string): void;
187
+ getTodaysDateInfo(): void;
188
+ generatetMonthData(date: string): void;
189
+ private highlightInitialDate;
190
+ private highlightInitialRange;
191
+ generateWeeksArray(daysArray: any): any;
192
+ changeCalendarMode(): void;
193
+ onDayClicked(day: DayInfo): void;
194
+ markDaySelected(dayInfo: DayInfo): void;
195
+ /**
196
+ * Handle range selection logic
197
+ * BACKWARD COMPATIBILITY: Only called when selectionMode='range'
198
+ *
199
+ * Range selection lifecycle:
200
+ * 1. First click → Sets rangeStart
201
+ * 2. Second click → Sets rangeEnd, highlights range
202
+ * 3. Third click → Resets range, starts new selection
203
+ */
204
+ private handleRangeSelection;
205
+ onConfirmClicked(): void;
206
+ checkFutureValidation(day: DayInfo): boolean;
207
+ checkTodaysDate(day: DayInfo): boolean;
208
+ /**
209
+ * Check if a day is disabled based on min/max date constraints
210
+ * Works for both Gregorian and Hijri modes
211
+ */
212
+ isDateDisabled(day: DayInfo): boolean;
213
+ /**
214
+ * Initialize time from current system time or initialDate
215
+ * BACKWARD COMPATIBILITY: Only called when enableTime=true
216
+ *
217
+ * Priority:
218
+ * 1. If initialDate has time, use that
219
+ * 2. If selectedDay has time, use that
220
+ * 3. Otherwise, use current system time
221
+ */
222
+ initializeTime(): void;
223
+ /**
224
+ * Increment hour value with wraparound (0-23)
225
+ * BACKWARD COMPATIBILITY: Only available when enableTime=true
226
+ */
227
+ incrementHour(): void;
228
+ /**
229
+ * Decrement hour value with wraparound (0-23)
230
+ * BACKWARD COMPATIBILITY: Only available when enableTime=true
231
+ */
232
+ decrementHour(): void;
233
+ /**
234
+ * Increment minute value with wraparound (0-59)
235
+ * BACKWARD COMPATIBILITY: Only available when enableTime=true
236
+ */
237
+ incrementMinute(): void;
238
+ /**
239
+ * Decrement minute value with wraparound (0-59)
240
+ * BACKWARD COMPATIBILITY: Only available when enableTime=true
241
+ */
242
+ decrementMinute(): void;
243
+ /**
244
+ * Handle keyboard input for hours
245
+ * Validates and clamps to 0-23 range
246
+ * BACKWARD COMPATIBILITY: Only available when enableTime=true
247
+ */
248
+ onHourInputChange(event: any): void;
249
+ /**
250
+ * Handle keyboard input for minutes
251
+ * Validates and clamps to 0-59 range
252
+ * BACKWARD COMPATIBILITY: Only available when enableTime=true
253
+ */
254
+ onMinuteInputChange(event: any): void;
255
+ /**
256
+ * Handle keyboard arrow keys for hour/minute input
257
+ * BACKWARD COMPATIBILITY: Only available when enableTime=true
258
+ */
259
+ onTimeKeydown(event: KeyboardEvent, type: 'hour' | 'minute'): void;
260
+ /**
261
+ * Update the selected day's time property when time changes
262
+ * BACKWARD COMPATIBILITY: Only called when enableTime=true
263
+ */
264
+ private updateSelectedDayTime;
265
+ /**
266
+ * Get display hour for 12-hour format
267
+ * BACKWARD COMPATIBILITY: Only used when useMeridian=true
268
+ *
269
+ * Conversion:
270
+ * - 0 (midnight) → 12 AM
271
+ * - 1-11 (AM) → 1-11 AM
272
+ * - 12 (noon) → 12 PM
273
+ * - 13-23 (PM) → 1-11 PM
274
+ *
275
+ * IMPORTANT: Hour 0 is NEVER displayed as 0, always as 12
276
+ */
277
+ getDisplayHour(): number;
278
+ /**
279
+ * Toggle AM/PM meridian
280
+ * BACKWARD COMPATIBILITY: Only available when useMeridian=true
281
+ *
282
+ * When toggling:
283
+ * - Adds or subtracts 12 hours
284
+ * - Maintains internal 24-hour format
285
+ */
286
+ toggleMeridian(): void;
287
+ /**
288
+ * Increment hour in 12-hour mode
289
+ * BACKWARD COMPATIBILITY: Only used when useMeridian=true
290
+ */
291
+ incrementHour12(): void;
292
+ /**
293
+ * Decrement hour in 12-hour mode
294
+ * BACKWARD COMPATIBILITY: Only used when useMeridian=true
295
+ */
296
+ decrementHour12(): void;
297
+ /**
298
+ * Handle 12-hour input change
299
+ * BACKWARD COMPATIBILITY: Only used when useMeridian=true
300
+ *
301
+ * IMPORTANT: Input must be 1-12, never 0
302
+ * - User types 0 → converted to 12
303
+ * - User types > 12 → clamped to 12
304
+ */
305
+ onHour12InputChange(event: any): void;
306
+ /**
307
+ * Check if a date is within the current range
308
+ * BACKWARD COMPATIBILITY: Only used when selectionMode='range'
309
+ */
310
+ isInRange(day: DayInfo): boolean;
311
+ /**
312
+ * Check if a date is the range start
313
+ * BACKWARD COMPATIBILITY: Only used when selectionMode='range'
314
+ */
315
+ isRangeStart(day: DayInfo): boolean;
316
+ /**
317
+ * Check if a date is the range end
318
+ * BACKWARD COMPATIBILITY: Only used when selectionMode='range'
319
+ */
320
+ isRangeEnd(day: DayInfo): boolean;
321
+ /**
322
+ * Reset range selection
323
+ * BACKWARD COMPATIBILITY: Only used when selectionMode='range'
324
+ */
325
+ private resetRange;
326
+ /**
327
+ * Parse date string (DD/MM/YYYY) to Date object
328
+ * Helper for range comparison
329
+ */
330
+ private parseDateString;
331
+ /**
332
+ * Highlight all dates in range
333
+ * BACKWARD COMPATIBILITY: Only used when selectionMode='range'
334
+ */
335
+ private highlightRange;
336
+ static ɵfac: i0.ɵɵFactoryDeclaration<HijriGregorianDatepickerComponent, never>;
337
+ static ɵcmp: i0.ɵɵComponentDeclaration<HijriGregorianDatepickerComponent, "hijri-gregorian-datepicker", never, { "markToday": { "alias": "markToday"; "required": false; }; "canChangeMode": { "alias": "canChangeMode"; "required": false; }; "todaysDateSection": { "alias": "todaysDateSection"; "required": false; }; "futureValidation": { "alias": "futureValidation"; "required": false; }; "disableYearPicker": { "alias": "disableYearPicker"; "required": false; }; "disableMonthPicker": { "alias": "disableMonthPicker"; "required": false; }; "disableDayPicker": { "alias": "disableDayPicker"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "isRequired": { "alias": "isRequired"; "required": false; }; "showConfirmButton": { "alias": "showConfirmButton"; "required": false; }; "futureValidationMessage": { "alias": "futureValidationMessage"; "required": false; }; "arabicLayout": { "alias": "arabicLayout"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "dir": { "alias": "dir"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; "submitTextButton": { "alias": "submitTextButton"; "required": false; }; "todaysDateText": { "alias": "todaysDateText"; "required": false; }; "ummAlQuraDateText": { "alias": "ummAlQuraDateText"; "required": false; }; "monthSelectLabel": { "alias": "monthSelectLabel"; "required": false; }; "yearSelectLabel": { "alias": "yearSelectLabel"; "required": false; }; "futureValidationMessageEn": { "alias": "futureValidationMessageEn"; "required": false; }; "futureValidationMessageAr": { "alias": "futureValidationMessageAr"; "required": false; }; "theme": { "alias": "theme"; "required": false; }; "pastYearsLimit": { "alias": "pastYearsLimit"; "required": false; }; "futureYearsLimit": { "alias": "futureYearsLimit"; "required": false; }; "styles": { "alias": "styles"; "required": false; }; "enableTime": { "alias": "enableTime"; "required": false; }; "minDate": { "alias": "minDate"; "required": false; }; "maxDate": { "alias": "maxDate"; "required": false; }; "initialDate": { "alias": "initialDate"; "required": false; }; "initialRangeStart": { "alias": "initialRangeStart"; "required": false; }; "initialRangeEnd": { "alias": "initialRangeEnd"; "required": false; }; "useMeridian": { "alias": "useMeridian"; "required": false; }; "selectionMode": { "alias": "selectionMode"; "required": false; }; }, { "onSubmit": "onSubmit"; "onDaySelect": "onDaySelect"; "onMonthChange": "onMonthChange"; "onYearChange": "onYearChange"; }, never, never, false, never>;
338
+ }
339
+
340
+ declare class HijriGregorianDatepickerModule {
341
+ static ɵfac: i0.ɵɵFactoryDeclaration<HijriGregorianDatepickerModule, never>;
342
+ static ɵmod: i0.ɵɵNgModuleDeclaration<HijriGregorianDatepickerModule, [typeof HijriGregorianDatepickerComponent], [typeof i2.FormsModule, typeof i2.ReactiveFormsModule, typeof i3.CommonModule], [typeof HijriGregorianDatepickerComponent]>;
343
+ static ɵinj: i0.ɵɵInjectorDeclaration<HijriGregorianDatepickerModule>;
344
+ }
345
+
346
+ export { DateUtilitiesService, HijriGregorianDatepickerComponent, HijriGregorianDatepickerModule };
347
+ export type { Data, DayInfo, MonthDays, MonthInfo, TimeValue, TodayDate, YearData };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "angular-hijri-gregorian-date-time-picker",
3
- "version": "1.5.0",
3
+ "version": "1.5.01",
4
4
  "description": "Angular Hijri Gregorian Date Time Picker with beautiful custom selects, time picker, range selection, and bilingual typography support",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {
7
- "@angular/common": "^15.2.9",
8
- "@angular/core": "^15.2.9",
9
- "@angular/forms": "^15.2.9"
7
+ "@angular/common": "^20.0.0",
8
+ "@angular/core": "^20.0.0",
9
+ "@angular/forms": "^20.0.0"
10
10
  },
11
11
  "dependencies": {
12
- "tslib": "^2.1.0"
12
+ "tslib": "^2.8.0"
13
13
  },
14
14
  "author": {
15
15
  "name": "Hany Gamal",
@@ -75,11 +75,7 @@
75
75
  "modern datepicker",
76
76
  "hany gamal"
77
77
  ],
78
- "module": "fesm2015/angular-hijri-gregorian-date-time-picker.mjs",
79
- "es2020": "fesm2020/angular-hijri-gregorian-date-time-picker.mjs",
80
- "esm2020": "esm2020/angular-hijri-gregorian-date-time-picker.mjs",
81
- "fesm2020": "fesm2020/angular-hijri-gregorian-date-time-picker.mjs",
82
- "fesm2015": "fesm2015/angular-hijri-gregorian-date-time-picker.mjs",
78
+ "module": "fesm2022/angular-hijri-gregorian-date-time-picker.mjs",
83
79
  "typings": "index.d.ts",
84
80
  "exports": {
85
81
  "./package.json": {
@@ -87,11 +83,7 @@
87
83
  },
88
84
  ".": {
89
85
  "types": "./index.d.ts",
90
- "esm2020": "./esm2020/angular-hijri-gregorian-date-time-picker.mjs",
91
- "es2020": "./fesm2020/angular-hijri-gregorian-date-time-picker.mjs",
92
- "es2015": "./fesm2015/angular-hijri-gregorian-date-time-picker.mjs",
93
- "node": "./fesm2015/angular-hijri-gregorian-date-time-picker.mjs",
94
- "default": "./fesm2020/angular-hijri-gregorian-date-time-picker.mjs"
86
+ "default": "./fesm2022/angular-hijri-gregorian-date-time-picker.mjs"
95
87
  }
96
88
  },
97
89
  "sideEffects": false
@@ -1,28 +0,0 @@
1
- export interface MonthInfo {
2
- fD: DayInfo;
3
- lD: DayInfo;
4
- }
5
- export interface YearData {
6
- [month: string]: MonthInfo;
7
- }
8
- export interface Data {
9
- [year: string]: YearData;
10
- }
11
- export interface TimeValue {
12
- hour: number;
13
- minute: number;
14
- }
15
- export interface DayInfo {
16
- gD: string;
17
- uD: string;
18
- dN: string;
19
- uC: number;
20
- selected?: boolean;
21
- disabled?: boolean;
22
- time?: TimeValue;
23
- }
24
- export interface TodayDate {
25
- gregorian?: string;
26
- ummAlQura?: string;
27
- }
28
- export type MonthDays = DayInfo[];
@@ -1,13 +0,0 @@
1
- export interface stylesConfig {
2
- backgroundColor?: string;
3
- primaryColor?: string;
4
- secondaryColor?: string;
5
- todaysDateBgColor?: string;
6
- todaysDateTextColor?: string;
7
- confirmBtnTextColor?: string;
8
- disabledDayColor?: string;
9
- dayNameColor?: string;
10
- dayColor?: string;
11
- fontFamily?: string;
12
- borderRadius?: string;
13
- }
@@ -1,49 +0,0 @@
1
- import { Data, DayInfo, MonthDays } from '../_interfaces/calendar-model';
2
- import * as i0 from "@angular/core";
3
- export declare class DateUtilitiesService {
4
- calendarData: Data;
5
- constructor();
6
- parseDate(dateStr: string): Date | null;
7
- formatDate(date: Date): string;
8
- getDayShortHand(date: Date): string;
9
- generateDates(fD: DayInfo, lD: DayInfo, uC: number): MonthDays;
10
- convertDate(dateStr: string, isGregorian: boolean): DayInfo | null;
11
- private isDateInMonthRange;
12
- getMonthData(inputDate: string, type: string): DayInfo[] | null;
13
- getGregorianMonthData(day: number, month: number, year: number): DayInfo[] | null;
14
- getUmAlQurraMonthData(day: number, month: number, year: number): DayInfo[] | null;
15
- calculateGregorianDate(startGDate: string, offset: number): string;
16
- calculateUmAlQurraDate(startUDate: string, offset: number, uC: number): string;
17
- getDayName(dayIndex: number): string;
18
- checkPastOrFuture(inputDate: any, targetDate: any): "Future" | "Past" | "Today";
19
- parseEnglish(englishNum: any): any;
20
- parseArabic(arabicNum: any): any;
21
- convertDateNumerals(date: string, targetLang: 'en' | 'ar'): string;
22
- /**
23
- * Normalize input date to DD/MM/YYYY string format (Gregorian)
24
- * Accepts Date object or DD/MM/YYYY string
25
- */
26
- normalizeDateToString(date: Date | string | undefined): string | null;
27
- /**
28
- * Compare two dates (Gregorian format DD/MM/YYYY)
29
- * Returns: -1 if date1 < date2, 0 if equal, 1 if date1 > date2
30
- */
31
- compareDates(date1Str: string, date2Str: string): number;
32
- /**
33
- * Compare two Hijri dates (UM format DD/MM/YYYY)
34
- * Converts to Gregorian for comparison
35
- */
36
- compareHijriDates(hijri1: string, hijri2: string): number;
37
- /**
38
- * Check if a date is within the specified range (inclusive)
39
- * All dates in Gregorian DD/MM/YYYY format
40
- */
41
- isDateInRange(dateStr: string, minDateStr: string | null, maxDateStr: string | null): boolean;
42
- /**
43
- * Check if a Hijri date is within the specified range
44
- * Converts to Gregorian for comparison
45
- */
46
- isHijriDateInRange(hijriDateStr: string, minDateStr: string | null, maxDateStr: string | null): boolean;
47
- static ɵfac: i0.ɵɵFactoryDeclaration<DateUtilitiesService, never>;
48
- static ɵprov: i0.ɵɵInjectableDeclaration<DateUtilitiesService>;
49
- }