@wavemaker/app-ng-runtime 11.7.1-next.24827 → 11.7.1-next.24830

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.
@@ -119,7 +119,7 @@ export declare abstract class BaseDateTimeComponent extends BaseFormCustomCompon
119
119
  /**
120
120
  * This method is used to highlight the current date
121
121
  */
122
- protected hightlightToday(): void;
122
+ protected hightlightToday(newDate: any): void;
123
123
  /**
124
124
  * This method is used to find the new date is from another year or not
125
125
  * @param newDate - newly selected date value
@@ -848,13 +848,18 @@
848
848
  /**
849
849
  * This method is used to highlight the current date
850
850
  */
851
- hightlightToday() {
852
- const toDay = new Date().getDate().toString();
853
- _.filter($(`span:contains(${toDay})`).not('.is-other-month'), (obj) => {
854
- if ($(obj).text() === toDay) {
855
- $(obj).addClass('current-date text-info');
856
- }
857
- });
851
+ hightlightToday(newDate) {
852
+ const activeMonth = $(`.bs-datepicker-head .current`).first().text();
853
+ const activeYear = $(".bs-datepicker-head .current").eq(1).text();
854
+ const monthName = new Date().toLocaleString('default', { month: 'long' });
855
+ if (activeMonth == monthName && activeYear == new Date().getFullYear() && newDate.getDate() === new Date().getDate() && newDate.getMonth() === new Date().getMonth() && newDate.getFullYear() === new Date().getFullYear()) {
856
+ const toDay = new Date().getDate().toString();
857
+ _.filter($(`span:contains(${toDay})`).not('.is-other-month'), (obj) => {
858
+ if ($(obj).text() === toDay) {
859
+ $(obj).addClass('current-date text-info');
860
+ }
861
+ });
862
+ }
858
863
  }
859
864
  /**
860
865
  * This method is used to find the new date is from another year or not
@@ -915,7 +920,10 @@
915
920
  setTimeout(() => {
916
921
  const newDay = newDate.getDate().toString();
917
922
  _.filter($(`span:contains(${newDay})`).not('.is-other-month'), (obj) => {
918
- if ($(obj).text() === newDay) {
923
+ const activeMonth = $(`.bs-datepicker-head .current`).first().text();
924
+ const activeYear = $(".bs-datepicker-head .current").eq(1).text();
925
+ const monthName = new Date().toLocaleString('default', { month: 'long' });
926
+ if ($(obj).text() === newDay && activeMonth == monthName && activeYear == new Date().getFullYear()) {
919
927
  if ($(obj).hasClass('selected')) {
920
928
  $(obj).parent().attr('aria-selected', 'true');
921
929
  }
@@ -926,8 +934,8 @@
926
934
  this.activeDate = newDate;
927
935
  }
928
936
  });
929
- if (newDate.getMonth() === new Date().getMonth() && newDate.getFullYear() === new Date().getFullYear()) {
930
- this.hightlightToday();
937
+ if (newDate.getDate() === new Date().getDate() && newDate.getMonth() === new Date().getMonth() && newDate.getFullYear() === new Date().getFullYear()) {
938
+ this.hightlightToday(newDate);
931
939
  }
932
940
  });
933
941
  }
@@ -1788,7 +1796,7 @@
1788
1796
  this.isOpen = true;
1789
1797
  this.bsDataValue ? this.activeDate = this.bsDataValue : this.activeDate = new Date();
1790
1798
  if (!this.bsDataValue) {
1791
- this.hightlightToday();
1799
+ this.hightlightToday(this.activeDate);
1792
1800
  }
1793
1801
  // We are using the two input tags(To maintain the modal and proxy modal) for the date control.
1794
1802
  // So actual bootstrap input target width we made it to 0, so bootstrap calculating the calendar container top position improperly.
@@ -2197,7 +2205,7 @@
2197
2205
  this.focusTrap.activate();
2198
2206
  this.bsDateValue ? this.activeDate = this.bsDateValue : this.activeDate = new Date();
2199
2207
  if (!this.bsDateValue) {
2200
- this.hightlightToday();
2208
+ this.hightlightToday(this.activeDate);
2201
2209
  }
2202
2210
  this.addDatepickerKeyboardEvents(this, true);
2203
2211
  i1$1.adjustContainerPosition($('bs-datepicker-container'), this.nativeElement, this.bsDatePickerDirective._datepicker);