* Instantiate the clock face. * * @public
(props?: ClockProps)
| 68 | * @public |
| 69 | */ |
| 70 | constructor(props?: ClockProps) { |
| 71 | this.date = props?.date ?? new Date(); |
| 72 | |
| 73 | if (props?.format) { |
| 74 | this.format = props.format; |
| 75 | } |
| 76 | |
| 77 | if (props?.formatter === undefined) { |
| 78 | this.formatter = useDateFormats(); |
| 79 | } |
| 80 | else if ('format' in props.formatter) { |
| 81 | this.formatter = props.formatter; |
| 82 | } |
| 83 | else { |
| 84 | this.formatter = useDateFormats(props.formatter); |
| 85 | } |
| 86 | |
| 87 | this.value = createRoot(() => { |
| 88 | return faceValue(this.formatter.format(this.date, this.format)); |
| 89 | }); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * The face's current value. |
nothing calls this directly
no test coverage detected