Fixed undefined month

This commit is contained in:
Gunnar Skjold
2024-08-03 07:32:10 +02:00
parent ac32f74eba
commit 11e09c5b56
4 changed files with 11 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
<script>
import { priceConfigStore, getPriceConfig } from './ConfigurationStore'
import { translationsStore } from './TranslationService';
import { wiki } from './Helpers.js';
import { wiki, zeropad } from './Helpers.js';
import Mask from './Mask.svelte'
import { navigate } from 'svelte-navigator';
@@ -170,7 +170,7 @@
<select name="rsm" class="in-m" bind:value={c.s.m}>
<option value={0}>-</option>
{#each {length: 12} as _,i}
<option value={i+1}>{translations.months?.[i]}</option>
<option value={i+1}>{translations.months ? translations.months?.[i] : zeropad(i+1)}</option>
{/each}
</select>
<input class="in-m" disabled value="to" style="width: 20px;color:#888;"/>
@@ -183,7 +183,7 @@
<select name="rem" class="in-l" bind:value={c.e.m}>
<option value={0}>-</option>
{#each {length: 12} as _,i}
<option value={i+1}>{translations.months?.[i]}</option>
<option value={i+1}>{translations.months ? translations.months?.[i] : zeropad(i+1)}</option>
{/each}
</select>
</div>

View File

@@ -33,7 +33,7 @@
color: dark ? '#5c2da5' : '#7c3aed'
});
xTicks.push({
label: peak.d > 0 ? zeropad(peak.d) + "." + translations.months?.[new Date().getMonth()] : "-"
label: peak.d > 0 ? zeropad(peak.d) + "." + (translations.months ? translations.months?.[new Date().getMonth()] : zeropad(new Date().getMonth()+1)) : "-"
})
max = Math.max(max, peak.v);
}

View File

@@ -27,6 +27,7 @@ export default defineConfig({
"/tariff.json": "http://192.168.233.49",
"/realtime.json": "http://192.168.233.49",
"/priceconfig.json": "http://192.168.233.49",
"/translations.json": "http://192.168.233.188",
"/cloudkey.json": "http://192.168.233.49",
"/save": "http://192.168.233.49",
"/reboot": "http://192.168.233.49",