@indigina/ui-kit 1.1.404 → 1.1.405
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.
|
@@ -3049,9 +3049,17 @@ class KitDateRangeSingleInput {
|
|
|
3049
3049
|
if (!start && !end) {
|
|
3050
3050
|
return '';
|
|
3051
3051
|
}
|
|
3052
|
-
const
|
|
3053
|
-
|
|
3054
|
-
|
|
3052
|
+
const isSameYear = start?.getFullYear() === end?.getFullYear();
|
|
3053
|
+
if (isSameYear) {
|
|
3054
|
+
const startString = this.formatDate(start);
|
|
3055
|
+
const endString = this.formatDate(end, true);
|
|
3056
|
+
return `${startString} - ${endString}`;
|
|
3057
|
+
}
|
|
3058
|
+
else {
|
|
3059
|
+
const startString = this.formatDate(start, true);
|
|
3060
|
+
const endString = this.formatDate(end, true);
|
|
3061
|
+
return `${startString} - ${endString}`;
|
|
3062
|
+
}
|
|
3055
3063
|
}
|
|
3056
3064
|
onPopupToggle() {
|
|
3057
3065
|
this.popup()?.toggle();
|
|
@@ -3070,8 +3078,12 @@ class KitDateRangeSingleInput {
|
|
|
3070
3078
|
this.updateDateRange({ start, end });
|
|
3071
3079
|
}
|
|
3072
3080
|
}
|
|
3073
|
-
formatDate(date) {
|
|
3074
|
-
|
|
3081
|
+
formatDate(date, includeYear = false) {
|
|
3082
|
+
if (!date) {
|
|
3083
|
+
return '';
|
|
3084
|
+
}
|
|
3085
|
+
const format = includeYear ? `${this.format()} y` : this.format();
|
|
3086
|
+
return this.datePipe.transform(date, format) || '';
|
|
3075
3087
|
}
|
|
3076
3088
|
updateDateRange(range) {
|
|
3077
3089
|
this.dateRange.set(range);
|