()
| 29 | } |
| 30 | |
| 31 | updateTime() { |
| 32 | const now = new Date(); |
| 33 | this.currentTime.set(now); |
| 34 | |
| 35 | const day = this.dayList[now.getDay()]; |
| 36 | let hour = now.getHours(); |
| 37 | const minute = now.getMinutes().toString().padStart(2, '0'); |
| 38 | const month = this.monthList[now.getMonth()]; |
| 39 | const date = now.getDate(); |
| 40 | const meridiem = hour < 12 ? 'AM' : 'PM'; |
| 41 | |
| 42 | if (hour > 12) hour -= 12; |
| 43 | if (hour === 0) hour = 12; |
| 44 | |
| 45 | this.displayTime.set(`${day} ${month} ${date} ${hour}:${minute} ${meridiem}`); |
| 46 | } |
| 47 | } |