(e, origin)
| 597 | } |
| 598 | |
| 599 | _formatValue(e, origin) { |
| 600 | if (this.targetEl.value === "") { |
| 601 | this._setTimeValue(null, origin); |
| 602 | return; |
| 603 | } |
| 604 | |
| 605 | // IE fires change event before blur |
| 606 | if (this._isFocused(this.targetEl) && (!e || e.type != "change")) { |
| 607 | return; |
| 608 | } |
| 609 | |
| 610 | var settings = this.settings; |
| 611 | var seconds = this.anytime2int(this.targetEl.value); |
| 612 | |
| 613 | if (seconds === null) { |
| 614 | const timeFormatErrorEvent = new CustomEvent('timeFormatError', EVENT_DEFAULTS); |
| 615 | this.targetEl.dispatchEvent(timeFormatErrorEvent); |
| 616 | return; |
| 617 | } |
| 618 | |
| 619 | var rangeError = this._isTimeRangeError(seconds, settings); |
| 620 | |
| 621 | if (settings.forceRoundTime) { |
| 622 | var roundSeconds = settings.roundingFunction(seconds, settings); |
| 623 | if (roundSeconds != seconds) { |
| 624 | seconds = roundSeconds; |
| 625 | origin = null; |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | var prettyTime = this._int2time(seconds); |
| 630 | |
| 631 | if (rangeError) { |
| 632 | this._setTimeValue(prettyTime); |
| 633 | const timeRangeErrorEvent = new CustomEvent('timeRangeError', EVENT_DEFAULTS); |
| 634 | this.targetEl.dispatchEvent(timeRangeErrorEvent); |
| 635 | } else { |
| 636 | this._setTimeValue(prettyTime, origin); |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | _isTimeRangeError(seconds, settings) { |
| 641 | // check that the time in within bounds |
no test coverage detected