hijri-date-time-picker 1.0.2 → 1.0.31

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.
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Date picker mode types
3
+ */
4
+ export type DateMode = "greg" | "hijri";
5
+
6
+ /**
7
+ * Text direction types
8
+ */
9
+ export type Direction = "ltr" | "rtl";
10
+
11
+ /**
12
+ * Locale types
13
+ */
14
+ export type Locale = "en" | "ar";
15
+
16
+ /**
17
+ * Selected date information
18
+ */
19
+ export interface SelectedDate {
20
+ gregorian: Date;
21
+ hijri: {
22
+ year: number;
23
+ month: number;
24
+ day: number;
25
+ };
26
+ time?: {
27
+ hours: number;
28
+ minutes: number;
29
+ seconds: number;
30
+ };
31
+ formatted: {
32
+ gregorian: string;
33
+ hijri: string;
34
+ time?: string;
35
+ };
36
+ }
37
+
38
+ /**
39
+ * Time format types
40
+ */
41
+ export type TimeFormat = "12" | "24";
42
+
43
+ /**
44
+ * Custom styling configuration
45
+ */
46
+ export interface DatePickerStyles {
47
+ primaryColor?: string;
48
+ secondaryColor?: string;
49
+ backgroundColor?: string;
50
+ textColor?: string;
51
+ selectedDateColor?: string;
52
+ selectedDateBackground?: string;
53
+ todayColor?: string;
54
+ disabledColor?: string;
55
+ borderColor?: string;
56
+ hoverColor?: string;
57
+ fontFamily?: string;
58
+ fontSize?: string;
59
+ borderRadius?: string;
60
+ }
61
+
62
+ /**
63
+ * Label configuration
64
+ */
65
+ export interface DatePickerLabels {
66
+ submitTextButton?: string;
67
+ todaysDateText?: string;
68
+ ummAlQuraDateText?: string;
69
+ yearSelectLabel?: string;
70
+ monthSelectLabel?: string;
71
+ }
72
+
73
+ /**
74
+ * Display configuration
75
+ */
76
+ export interface DatePickerDisplay {
77
+ todaysDateSection?: boolean;
78
+ markToday?: boolean;
79
+ disableYearPicker?: boolean;
80
+ disableMonthPicker?: boolean;
81
+ disableDayPicker?: boolean;
82
+ }
83
+
84
+ /**
85
+ * Month names in different locales
86
+ */
87
+ export const GREGORIAN_MONTHS_EN = [
88
+ "January",
89
+ "February",
90
+ "March",
91
+ "April",
92
+ "May",
93
+ "June",
94
+ "July",
95
+ "August",
96
+ "September",
97
+ "October",
98
+ "November",
99
+ "December",
100
+ ];
101
+
102
+ export const GREGORIAN_MONTHS_AR = [
103
+ "يناير",
104
+ "فبراير",
105
+ "مارس",
106
+ "أبريل",
107
+ "مايو",
108
+ "يونيو",
109
+ "يوليو",
110
+ "أغسطس",
111
+ "سبتمبر",
112
+ "أكتوبر",
113
+ "نوفمبر",
114
+ "ديسمبر",
115
+ ];
116
+
117
+ export const HIJRI_MONTHS_EN = [
118
+ "Muharram",
119
+ "Safar",
120
+ "Rabi' al-Awwal",
121
+ "Rabi' al-Thani",
122
+ "Jumada al-Awwal",
123
+ "Jumada al-Thani",
124
+ "Rajab",
125
+ "Sha'ban",
126
+ "Ramadan",
127
+ "Shawwal",
128
+ "Dhu al-Qi'dah",
129
+ "Dhu al-Hijjah",
130
+ ];
131
+
132
+ export const HIJRI_MONTHS_AR = [
133
+ "محرم",
134
+ "صفر",
135
+ "ربيع الأول",
136
+ "ربيع الثاني",
137
+ "جمادى الأولى",
138
+ "جمادى الثانية",
139
+ "رجب",
140
+ "شعبان",
141
+ "رمضان",
142
+ "شوال",
143
+ "ذو القعدة",
144
+ "ذو الحجة",
145
+ ];
146
+
147
+ export const WEEKDAY_NAMES_EN = [
148
+ "Sun",
149
+ "Mon",
150
+ "Tue",
151
+ "Wed",
152
+ "Thu",
153
+ "Fri",
154
+ "Sat",
155
+ ];
156
+ export const WEEKDAY_NAMES_AR = [
157
+ "الأحد",
158
+ "الإثنين",
159
+ "الثلاثاء",
160
+ "الأربعاء",
161
+ "الخميس",
162
+ "الجمعة",
163
+ "السبت",
164
+ ];
@@ -0,0 +1,43 @@
1
+ declare module 'hijri-date/lib/safe' {
2
+ export default class HijriDate {
3
+ constructor();
4
+ constructor(year: number, month: number, day: number);
5
+ constructor(year: number, month: number, day: number, hours: number, minutes: number, seconds: number, milliseconds: number);
6
+
7
+ getFullYear(): number;
8
+ getMonth(): number;
9
+ getDate(): number;
10
+ getDay(): number;
11
+ getHours(): number;
12
+ getMinutes(): number;
13
+ getSeconds(): number;
14
+ getMilliseconds(): number;
15
+
16
+ setFullYear(year: number): void;
17
+ setMonth(month: number): void;
18
+ setDate(day: number): void;
19
+ setHours(hours: number): void;
20
+ setMinutes(minutes: number): void;
21
+ setSeconds(seconds: number): void;
22
+ setMilliseconds(milliseconds: number): void;
23
+
24
+ toGregorian(): Date;
25
+ toString(): string;
26
+ format(format: string): string;
27
+
28
+ isToday(): boolean;
29
+ isYesterday(): boolean;
30
+ isTomorrow(): boolean;
31
+
32
+ clone(): HijriDate;
33
+ ignoreTime(): HijriDate;
34
+ }
35
+
36
+ export function toHijri(date: Date): HijriDate;
37
+ }
38
+
39
+ declare module 'hijri-date' {
40
+ import HijriDate from 'hijri-date/lib/safe';
41
+ export default HijriDate;
42
+ export { toHijri } from 'hijri-date/lib/safe';
43
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "lib": [
6
+ "ES2022",
7
+ "DOM"
8
+ ],
9
+ "moduleResolution": "node",
10
+ "declaration": true,
11
+ "outDir": "./dist",
12
+ "rootDir": "./src",
13
+ "strict": true,
14
+ "esModuleInterop": true,
15
+ "skipLibCheck": true,
16
+ "forceConsistentCasingInFileNames": true,
17
+ "experimentalDecorators": true,
18
+ "emitDecoratorMetadata": true,
19
+ "skipDefaultLibCheck": true,
20
+ "importHelpers": true,
21
+ "sourceMap": true,
22
+ "inlineSources": true,
23
+ "types": []
24
+ },
25
+ "angularCompilerOptions": {
26
+ "skipTemplateCodegen": true,
27
+ "strictMetadataEmit": true,
28
+ "enableResourceInlining": true,
29
+ "compilationMode": "partial"
30
+ },
31
+ "include": [
32
+ "src/**/*"
33
+ ],
34
+ "exclude": [
35
+ "node_modules",
36
+ "dist",
37
+ "src/demo.ts"
38
+ ]
39
+ }
package/dist/LICENSE DELETED
@@ -1,21 +0,0 @@
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 DELETED
@@ -1,185 +0,0 @@
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 DELETED
@@ -1,12 +0,0 @@
1
- import { SelectedDate, DatePickerStyles } from './lib/hijri-date-picker.types';
2
- export declare class DemoComponent {
3
- selectedDates: {
4
- [key: string]: any;
5
- };
6
- today: Date;
7
- minDate: Date;
8
- maxDate: Date;
9
- maxFutureDate: Date;
10
- customStyles: DatePickerStyles;
11
- onDateSelected(date: SelectedDate | SelectedDate[], key: string): void;
12
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './index';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGlqcmktZGF0ZS10aW1lLXBpY2tlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9oaWpyaS1kYXRlLXRpbWUtcGlja2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
@@ -1,3 +0,0 @@
1
- export { HijriDatePickerComponent } from './lib/hijri-date-picker.component';
2
- export * from './lib/hijri-date-picker.types';
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHdCQUF3QixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDN0UsY0FBYywrQkFBK0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IEhpanJpRGF0ZVBpY2tlckNvbXBvbmVudCB9IGZyb20gJy4vbGliL2hpanJpLWRhdGUtcGlja2VyLmNvbXBvbmVudCc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9oaWpyaS1kYXRlLXBpY2tlci50eXBlcyc7XG4iXX0=