* Sets the hours, minutes, and optionally seconds * of the latest selected date object and the * corresponding time inputs * @param {Number} hours the hour. whether its military * or am-pm gets inferred from config * @param {Number} minutes the minutes * @param {Num
(hours: number, minutes: number, seconds: number)
| 339 | * @param {Number} seconds the seconds (optional) |
| 340 | */ |
| 341 | function setHours(hours: number, minutes: number, seconds: number) { |
| 342 | if (self.latestSelectedDateObj !== undefined) { |
| 343 | self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0); |
| 344 | } |
| 345 | |
| 346 | if (!self.hourElement || !self.minuteElement || self.isMobile) return; |
| 347 | |
| 348 | self.hourElement.value = pad( |
| 349 | !self.config.time_24hr |
| 350 | ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0) |
| 351 | : hours |
| 352 | ); |
| 353 | |
| 354 | self.minuteElement.value = pad(minutes); |
| 355 | |
| 356 | if (self.amPM !== undefined) |
| 357 | self.amPM.textContent = self.l10n.amPM[int(hours >= 12)]; |
| 358 | |
| 359 | if (self.secondElement !== undefined) |
| 360 | self.secondElement.value = pad(seconds); |
| 361 | } |
| 362 | |
| 363 | /** |
| 364 | * Handles the year input and incrementing events |
no test coverage detected
searching dependent graphs…