Skip to content

Commit 55540f1

Browse files
committed
take time format from settings on mount
1 parent aced887 commit 55540f1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "dht22-webui"
3-
version = "1.0.0"
3+
version = "1.0.1"
44
description = "DHT22 Sensor monitoring system"
55
readme = "README.md"
66
requires-python = ">=3.12"

templates/index.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ <h2>Historical Data</h2>
595595
day: 'numeric',
596596
hour: settings.timeFormat === '24h' ? '2-digit' : 'numeric',
597597
minute: '2-digit',
598-
hour12: settings.timeFormat === '12h'
598+
hour12: settings.timeFormat !== '24h'
599599
});
600600
};
601601
});
@@ -668,9 +668,9 @@ <h2>Historical Data</h2>
668668
return date.toLocaleString('en-US', {
669669
month: 'short',
670670
day: 'numeric',
671-
hour: 'numeric',
671+
hour: settings.timeFormat === '24h' ? '2-digit' : 'numeric',
672672
minute: '2-digit',
673-
hour12: true
673+
hour12: settings.timeFormat !== '24h'
674674
});
675675
},
676676
label: function (context) {
@@ -689,12 +689,12 @@ <h2>Historical Data</h2>
689689
time: {
690690
unit: 'minute',
691691
displayFormats: {
692-
minute: 'HH:mm',
693-
hour: 'HH:mm',
692+
minute: settings.timeFormat === '24h' ? 'HH:mm' : 'hh:mm a',
693+
hour: settings.timeFormat === '24h' ? 'HH:mm' : 'hh:mm a',
694694
day: 'MMM D',
695695
month: 'MMM YYYY'
696696
},
697-
tooltipFormat: 'MMM D, HH:mm'
697+
tooltipFormat: settings.timeFormat === '24h' ? 'MMM D, HH:mm' : 'MMM D, hh:mm a'
698698
},
699699
grid: {
700700
display: false

0 commit comments

Comments
 (0)