mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-07 22:08:55 +01:00
SendTime - optimated
This commit is contained in:
@@ -3267,11 +3267,12 @@ function SendDate(): void {
|
|||||||
|
|
||||||
function SendTime(): void {
|
function SendTime(): void {
|
||||||
try {
|
try {
|
||||||
const d = new Date();
|
/*const d = new Date();
|
||||||
const hr = (d.getHours() < 10 ? '0' : '') + d.getHours();
|
const hr = (d.getHours() < 10 ? '0' : '') + d.getHours();
|
||||||
const min = (d.getMinutes() < 10 ? '0' : '') + d.getMinutes();
|
const min = (d.getMinutes() < 10 ? '0' : '') + d.getMinutes();
|
||||||
|
|
||||||
SendToPanel(<NSPanel.Payload>{ payload: 'time~' + hr + ':' + min });
|
SendToPanel(<NSPanel.Payload>{ payload: 'time~' + hr + ':' + min });*/
|
||||||
|
SendToPanel(<NSPanel.Payload>{ payload: `time~${new Date().toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}`, });
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
log('error at function SendTime: ' + err.message, 'warn');
|
log('error at function SendTime: ' + err.message, 'warn');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user