@arsedizioni/ars-utils 19.3.8 → 19.3.10

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.
@@ -1593,14 +1593,23 @@ class ClipperSearchCalendarComponent {
1593
1593
  filterByDate(date) {
1594
1594
  if (date === 'month') {
1595
1595
  if (this.calendarDate) {
1596
- this.changed.emit(new DateInterval(endOfDay(startOfMonth(this.calendarDate)), endOfMonth(this.calendarDate)));
1596
+ const today = new Date();
1597
+ const start = endOfDay(startOfMonth(this.calendarDate));
1598
+ const end = endOfMonth(this.calendarDate);
1599
+ this.changed.emit(new DateInterval(start, end));
1600
+ if (start <= today && end >= today) {
1601
+ const calendar = this.calendar();
1602
+ calendar.selected = today;
1603
+ calendar.updateTodaysDate();
1604
+ }
1597
1605
  }
1598
1606
  }
1599
1607
  else if (date) {
1600
1608
  this.changed.emit(new DateInterval(endOfDay(date), endOfDay(date)));
1601
1609
  this.calendarDate = date;
1602
1610
  const calendar = this.calendar();
1603
- calendar.activeDate = date;
1611
+ calendar.selected = date;
1612
+ calendar.updateTodaysDate();
1604
1613
  }
1605
1614
  else {
1606
1615
  this.changed.emit(null);
@@ -1611,10 +1620,16 @@ class ClipperSearchCalendarComponent {
1611
1620
  * @param monthInfo: the month info
1612
1621
  */
1613
1622
  filterByMonth(monthInfo) {
1614
- let newDate = new Date(monthInfo.year, monthInfo.month - 1, 1);
1615
- this.changed.emit(new DateInterval(endOfDay(startOfMonth(newDate)), endOfMonth(newDate)));
1623
+ const newDate = new Date(monthInfo.year, monthInfo.month - 1, 1);
1624
+ const today = new Date();
1625
+ const start = endOfDay(startOfMonth(newDate));
1626
+ const end = endOfMonth(newDate);
1627
+ this.changed.emit(new DateInterval(start, end));
1616
1628
  this.calendarSpecialDays = monthInfo.days;
1617
1629
  const calendar = this.calendar();
1630
+ if (start <= today && end >= today) {
1631
+ calendar.selected = today;
1632
+ }
1618
1633
  calendar.activeDate = newDate;
1619
1634
  calendar.updateTodaysDate();
1620
1635
  this.calendarDate = newDate;