v3.7.3.1 - Hotfix - Dateformat us-p

Hotfix - us-p - DateString - Use long/short Weekday and long/short Month
This commit is contained in:
Armilar
2022-12-29 11:39:10 +01:00
committed by GitHub
parent acfb380942
commit 71e69a3e44

View File

@@ -1,5 +1,5 @@
/*-----------------------------------------------------------------------
TypeScript v3.7.3.0 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar/@Sternmiere/@Britzelpuf
TypeScript v3.7.3.1 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar/@Sternmiere/@Britzelpuf
- abgestimmt auf TFT 46 / v3.7.3 / BerryDriver 8 / Tasmota 12.3.1
@joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker
NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts
@@ -104,6 +104,7 @@ ReleaseNotes:
- 23.10.2022 - v3.7.0 Upgrade TFT 46
- 28.12.2022 - v3.7.3.0 Hotfix - bUp case
- 28.12.2022 - v3.7.3.0 Update Berry Version 8
- 29.12.2022 - v3.7.3.1 Hotfix - us-p - DateString - Use long/short Weekday and long/short Month
*****************************************************************************************************************
* Falls Aliase durch das Skript erstellt werden sollen, muss in der JavaScript Instanz "setObect" gesetzt sein! *
@@ -163,11 +164,11 @@ Interne Sonoff-Sensoren (über Tasmota):
(!!! Achtung: der interne Sonoff-Sensor liefert keine exakten Daten, da das NSPanel-Board und der ESP selbst Hitze produzieren !!!
ggf. Offset einplanen oder besser einen externen Sensor über Zigbee etc. verwenden)
Timestamp - wird in 0_userdata.0. Zeitpunkt der letzten Sensorübertragung
Tasmota-Status0 - (zyklische Ausführung)
liefert relevanten Tasmota-Informationen und kann bei Bedarf in "function get_tasmota_status0()" erweitert werden. Daten werden in 0_userdata.0. abgelegt
Erforderliche Adapter:
AccuWeather: - Bei Nutzung der Wetterfunktionen (und zur Icon-Konvertierung) im Screensaver
Alexa2: - Bei Nutzung der dynamischen SpeakerList in der cardMedia
Geräte verwalten - Für Erstellung der Aliase
@@ -503,6 +504,16 @@ async function InitAlternateMRIconsSize() {
}
InitAlternateMRIconsSize();
//DateString short/long
async function InitDateformat() {
if (existsState(NSPanel_Path + 'Config.Dateformat.weekday') == false ||
existsState(NSPanel_Path + 'Config.Dateformat.month') == false) {
await createStateAsync(NSPanel_Path + 'Config.Dateformat.weekday', 'long', { type: 'string' });
await createStateAsync(NSPanel_Path + 'Config.Dateformat.month', 'long', { type: 'string' });
}
}
InitDateformat();
on({id: [].concat(String(NSPanel_Path) + 'Relay.1').concat(String(NSPanel_Path) + 'Relay.2'), change: "ne"}, async function (obj) {
try {
let Button = obj.id.split('.');
@@ -1617,8 +1628,11 @@ function HandleStartupProcess(): void {
function SendDate(): void {
try {
let dpWeekday = existsObject(NSPanel_Path + 'Config.Dateformat.weekday') ? getState(NSPanel_Path + 'Config.Dateformat.weekday').val : 'short'
let dpMonth = existsObject(NSPanel_Path + 'Config.Dateformat.month') ? getState(NSPanel_Path + 'Config.Dateformat.month').val : 'short'
const date = new Date();
const options: any = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
const options: any = { weekday: dpWeekday, year: 'numeric', month: dpMonth, day: 'numeric' };
const _SendDate = date.toLocaleDateString(config.locale, options);
SendToPanel(<Payload>{ payload: 'date~' + _SendDate });