* Set the calendar view to a particular date. * @param {Date} jumpDate the date to set the view to * @param {boolean} triggerChange if change events should be triggered
(jumpDate?: DateOption, triggerChange?: boolean)
| 499 | * @param {boolean} triggerChange if change events should be triggered |
| 500 | */ |
| 501 | function jumpToDate(jumpDate?: DateOption, triggerChange?: boolean) { |
| 502 | const jumpTo = |
| 503 | jumpDate !== undefined |
| 504 | ? self.parseDate(jumpDate) |
| 505 | : self.latestSelectedDateObj || |
| 506 | (self.config.minDate && self.config.minDate > self.now |
| 507 | ? self.config.minDate |
| 508 | : self.config.maxDate && self.config.maxDate < self.now |
| 509 | ? self.config.maxDate |
| 510 | : self.now); |
| 511 | |
| 512 | const oldYear = self.currentYear; |
| 513 | const oldMonth = self.currentMonth; |
| 514 | |
| 515 | try { |
| 516 | if (jumpTo !== undefined) { |
| 517 | self.currentYear = jumpTo.getFullYear(); |
| 518 | self.currentMonth = jumpTo.getMonth(); |
| 519 | } |
| 520 | } catch (e) { |
| 521 | /* istanbul ignore next */ |
| 522 | e.message = "Invalid date supplied: " + jumpTo; |
| 523 | self.config.errorHandler(e); |
| 524 | } |
| 525 | |
| 526 | if (triggerChange && self.currentYear !== oldYear) { |
| 527 | triggerEvent("onYearChange"); |
| 528 | buildMonthSwitch(); |
| 529 | } |
| 530 | |
| 531 | if ( |
| 532 | triggerChange && |
| 533 | (self.currentYear !== oldYear || self.currentMonth !== oldMonth) |
| 534 | ) { |
| 535 | triggerEvent("onMonthChange"); |
| 536 | } |
| 537 | |
| 538 | self.redraw(); |
| 539 | } |
| 540 | |
| 541 | /** |
| 542 | * The up/down arrow handler for time inputs |
no test coverage detected
searching dependent graphs…