ngxsmk-datepicker 1.9.13 → 1.9.14
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 +8 -1
- package/fesm2022/ngxsmk-datepicker.mjs +30 -5
- package/index.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
**npm i ngxsmk-datepicker**
|
|
10
10
|
|
|
11
|
-
> **Stable Version**: `1.9.
|
|
11
|
+
> **Stable Version**: `1.9.14` is the current stable release. For production use, install the latest version from npm.
|
|
12
12
|
|
|
13
13
|
ngxsmk-datepicker – A modern, powerful, and fully customizable date and date-range picker component designed for Angular 17+ and Ionic applications. Seamlessly integrates with both frameworks, offering a flexible, mobile-friendly UI and advanced features to enhance date selection experiences in your apps.
|
|
14
14
|
|
|
@@ -736,6 +736,13 @@ We welcome and appreciate contributions from the community! Whether it's reporti
|
|
|
736
736
|
|
|
737
737
|
## **📄 Changelog**
|
|
738
738
|
|
|
739
|
+
### **v1.9.14** (Stable)
|
|
740
|
+
- 🐛 **Date Picker Selection Fix**: Fixed date picker selection issues, especially in range mode
|
|
741
|
+
- 🐛 **Moment.js Timezone Support**: Fixed timezone offset preservation for Moment.js objects
|
|
742
|
+
- 🎉 **Version Update**: Updated to version 1.9.14
|
|
743
|
+
- ✅ **Stable Release**: Version 1.9.14 is the current stable version
|
|
744
|
+
- 🔄 **Backward Compatible**: Full backward compatibility with v1.9.13
|
|
745
|
+
|
|
739
746
|
### **v1.9.13** (Stable)
|
|
740
747
|
- 🐛 **Bug Fixes**: Fixed `valueChange` event emitting null for range mode with ngModel
|
|
741
748
|
- 🐛 **Bug Fixes**: Fixed date selection becoming disabled after month navigation in range mode
|
|
@@ -3753,7 +3753,7 @@ class NgxsmkDatepickerComponent {
|
|
|
3753
3753
|
}
|
|
3754
3754
|
else if (this.isMomentObject(val)) {
|
|
3755
3755
|
const momentObj = val;
|
|
3756
|
-
return this._normalizeDate(
|
|
3756
|
+
return this._normalizeDate(this.momentToDate(momentObj));
|
|
3757
3757
|
}
|
|
3758
3758
|
else if (typeof val === 'object' && val !== null && 'start' in val && 'end' in val) {
|
|
3759
3759
|
const rangeVal = val;
|
|
@@ -3761,14 +3761,14 @@ class NgxsmkDatepickerComponent {
|
|
|
3761
3761
|
let end;
|
|
3762
3762
|
if (this.isMomentObject(rangeVal.start)) {
|
|
3763
3763
|
const momentStart = rangeVal.start;
|
|
3764
|
-
start = this._normalizeDate(
|
|
3764
|
+
start = this._normalizeDate(this.momentToDate(momentStart));
|
|
3765
3765
|
}
|
|
3766
3766
|
else {
|
|
3767
3767
|
start = this._normalizeDate(rangeVal.start);
|
|
3768
3768
|
}
|
|
3769
3769
|
if (this.isMomentObject(rangeVal.end)) {
|
|
3770
3770
|
const momentEnd = rangeVal.end;
|
|
3771
|
-
end = this._normalizeDate(
|
|
3771
|
+
end = this._normalizeDate(this.momentToDate(momentEnd));
|
|
3772
3772
|
}
|
|
3773
3773
|
else {
|
|
3774
3774
|
end = this._normalizeDate(rangeVal.end);
|
|
@@ -3782,7 +3782,7 @@ class NgxsmkDatepickerComponent {
|
|
|
3782
3782
|
return val.map(d => {
|
|
3783
3783
|
if (this.isMomentObject(d)) {
|
|
3784
3784
|
const momentObj = d;
|
|
3785
|
-
return this._normalizeDate(
|
|
3785
|
+
return this._normalizeDate(this.momentToDate(momentObj));
|
|
3786
3786
|
}
|
|
3787
3787
|
return this._normalizeDate(d);
|
|
3788
3788
|
}).filter((d) => d !== null);
|
|
@@ -3813,6 +3813,26 @@ class NgxsmkDatepickerComponent {
|
|
|
3813
3813
|
typeof obj['isMoment']() === 'boolean' &&
|
|
3814
3814
|
obj['isMoment']() === true;
|
|
3815
3815
|
}
|
|
3816
|
+
/**
|
|
3817
|
+
* Convert a Moment.js object to a Date, preserving timezone offset
|
|
3818
|
+
*/
|
|
3819
|
+
momentToDate(momentObj) {
|
|
3820
|
+
if (typeof momentObj.utcOffset === 'function' && typeof momentObj.format === 'function') {
|
|
3821
|
+
const offset = momentObj.utcOffset();
|
|
3822
|
+
if (offset !== undefined && offset !== null) {
|
|
3823
|
+
try {
|
|
3824
|
+
const formatted = momentObj.format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
|
3825
|
+
const date = new Date(formatted);
|
|
3826
|
+
if (!isNaN(date.getTime())) {
|
|
3827
|
+
return date;
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
catch {
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3834
|
+
return momentObj.toDate();
|
|
3835
|
+
}
|
|
3816
3836
|
isValueEqual(val1, val2) {
|
|
3817
3837
|
if (val1 === val2)
|
|
3818
3838
|
return true;
|
|
@@ -4177,15 +4197,18 @@ class NgxsmkDatepickerComponent {
|
|
|
4177
4197
|
this.startDate = this.applyTimeIfNeeded(day);
|
|
4178
4198
|
this.endDate = null;
|
|
4179
4199
|
this.hoveredDate = null;
|
|
4200
|
+
this._invalidateMemoCache();
|
|
4201
|
+
this.scheduleChangeDetection();
|
|
4180
4202
|
}
|
|
4181
4203
|
else if (this.startDate && !this.endDate) {
|
|
4182
4204
|
if (dayTime < startTime) {
|
|
4183
4205
|
this.startDate = this.applyTimeIfNeeded(day);
|
|
4184
4206
|
this.endDate = null;
|
|
4185
4207
|
this.hoveredDate = null;
|
|
4208
|
+
this._invalidateMemoCache();
|
|
4209
|
+
this.scheduleChangeDetection();
|
|
4186
4210
|
}
|
|
4187
4211
|
else if (dayTime === startTime) {
|
|
4188
|
-
// Same day selected - no action needed
|
|
4189
4212
|
}
|
|
4190
4213
|
else {
|
|
4191
4214
|
const potentialEndDate = this.applyTimeIfNeeded(day);
|
|
@@ -4194,12 +4217,14 @@ class NgxsmkDatepickerComponent {
|
|
|
4194
4217
|
this.startDate = potentialEndDate;
|
|
4195
4218
|
this.endDate = null;
|
|
4196
4219
|
this.hoveredDate = null;
|
|
4220
|
+
this._invalidateMemoCache();
|
|
4197
4221
|
this.scheduleChangeDetection();
|
|
4198
4222
|
return;
|
|
4199
4223
|
}
|
|
4200
4224
|
}
|
|
4201
4225
|
this.endDate = potentialEndDate;
|
|
4202
4226
|
this.hoveredDate = null;
|
|
4227
|
+
this._invalidateMemoCache();
|
|
4203
4228
|
this.emitValue({ start: this.startDate, end: this.endDate });
|
|
4204
4229
|
const startFormatted = formatDateWithTimezone(this.startDate, this.locale, {
|
|
4205
4230
|
year: 'numeric',
|
package/index.d.ts
CHANGED
|
@@ -500,6 +500,10 @@ declare class NgxsmkDatepickerComponent implements OnInit, OnChanges, OnDestroy,
|
|
|
500
500
|
* Check if the provided value is a Moment.js object
|
|
501
501
|
*/
|
|
502
502
|
private isMomentObject;
|
|
503
|
+
/**
|
|
504
|
+
* Convert a Moment.js object to a Date, preserving timezone offset
|
|
505
|
+
*/
|
|
506
|
+
private momentToDate;
|
|
503
507
|
private isValueEqual;
|
|
504
508
|
private parseDateString;
|
|
505
509
|
/**
|