Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
a84cf21
initialize hour24
ildar170975 Apr 30, 2025
70903e7
pass hass to buildConfig()
ildar170975 Apr 30, 2025
6e27230
Update buildConfig.js
ildar170975 Apr 30, 2025
e78805e
Update buildConfig.js
ildar170975 Apr 30, 2025
0614f6f
Update buildConfig.js
ildar170975 Apr 30, 2025
aae2e8e
Update buildConfig.js
ildar170975 Apr 30, 2025
919cb30
Update buildConfig.js
ildar170975 Apr 30, 2025
af055e3
Update buildConfig.js
ildar170975 Apr 30, 2025
3eb19da
Update buildConfig.js
ildar170975 Apr 30, 2025
1fefa9b
Update buildConfig.js
ildar170975 Apr 30, 2025
d13048f
Update buildConfig.js
ildar170975 Apr 30, 2025
6c6d603
Update buildConfig.js
ildar170975 Apr 30, 2025
2b72235
Update main.js
ildar170975 Apr 30, 2025
9f33032
Update main.js
ildar170975 Apr 30, 2025
a9bd5c3
Update main.js
ildar170975 Apr 30, 2025
7c95476
Update buildConfig.js
ildar170975 Apr 30, 2025
0961b36
Update main.js
ildar170975 Apr 30, 2025
0321f32
Update buildConfig.js
ildar170975 Apr 30, 2025
f6e2460
Update buildConfig.js
ildar170975 Apr 30, 2025
54c5df5
Update buildConfig.js
ildar170975 Apr 30, 2025
644e729
Update main.js
ildar170975 Apr 30, 2025
ce9f3cc
Update buildConfig.js
ildar170975 Apr 30, 2025
fb79ec6
Update buildConfig.js
ildar170975 Apr 30, 2025
3e41589
Update buildConfig.js
ildar170975 Apr 30, 2025
a6b2fd5
Update main.js
ildar170975 Apr 30, 2025
8fb42b5
Update main.js
ildar170975 Apr 30, 2025
0f5589d
Update buildConfig.js
ildar170975 Apr 30, 2025
fc50c7e
Update buildConfig.js
ildar170975 Apr 30, 2025
c952fd8
Update buildConfig.js
ildar170975 Apr 30, 2025
c812205
Update buildConfig.js
ildar170975 Apr 30, 2025
741ef4a
Update buildConfig.js
ildar170975 Apr 30, 2025
d93417f
Update buildConfig.js
ildar170975 Apr 30, 2025
87485e1
Update buildConfig.js
ildar170975 Apr 30, 2025
29d495a
Update buildConfig.js
ildar170975 Apr 30, 2025
4cd1cad
Update main.js
ildar170975 Apr 30, 2025
262f3d7
Update main.js
ildar170975 Apr 30, 2025
249fe99
Update main.js
ildar170975 Apr 30, 2025
5524603
Update main.js
ildar170975 Apr 30, 2025
0ffc326
Update main.js
ildar170975 Apr 30, 2025
2638042
Update utils.js
ildar170975 Apr 30, 2025
0b88ab4
Update buildConfig.js
ildar170975 Apr 30, 2025
af0aabc
Update utils.js
ildar170975 Apr 30, 2025
9a89469
Update main.js
ildar170975 Apr 30, 2025
1d38b6d
Update main.js
ildar170975 Apr 30, 2025
2a6f88d
Update buildConfig.js
ildar170975 Apr 30, 2025
0451324
Update main.js
ildar170975 Apr 30, 2025
bca254a
Update utils.js
ildar170975 Apr 30, 2025
1688e94
Update main.js
ildar170975 Apr 30, 2025
d94d2d7
Update utils.js
ildar170975 Apr 30, 2025
6a6d972
Update utils.js
ildar170975 Apr 30, 2025
fe64622
Update utils.js
ildar170975 Apr 30, 2025
b575600
Update utils.js
ildar170975 Apr 30, 2025
722e25d
move time format functions to locale.js
ildar170975 Mar 7, 2026
bd0f9a3
move getHourFormat & getHour24 to locale.js
ildar170975 Mar 7, 2026
b5e880d
move getHourFormat to locale.js
ildar170975 Mar 7, 2026
e7a537c
remove blank line
ildar170975 Mar 7, 2026
1d9281a
move getHourFormat & getHour24 to locale.js
ildar170975 Mar 7, 2026
d46c836
remove blank line
ildar170975 Mar 7, 2026
ea7050e
Merge branch 'dev' into hour24-from-locale
ildar170975 Mar 7, 2026
2907e8e
add a description for updateOptionsFromLocale()
ildar170975 Mar 9, 2026
a2d49cc
extract a code for date format into getDateFormat()
ildar170975 Mar 9, 2026
bf6c4f4
add getDateFormat(), add descriptions for functions
ildar170975 Mar 9, 2026
941f35f
linter
ildar170975 Mar 9, 2026
3330b18
fix format update
ildar170975 Mar 9, 2026
e4332f2
linter
ildar170975 Mar 9, 2026
c387caf
styling
ildar170975 Mar 12, 2026
5fee27a
add a description to TimeFormat
ildar170975 Mar 12, 2026
5c195c5
refactor to formatDateTime()
ildar170975 Mar 17, 2026
ee3ecd0
remove unused
ildar170975 Mar 17, 2026
53fce23
refactor to formatDateTime()
ildar170975 Mar 17, 2026
1692498
remove unused
ildar170975 Mar 17, 2026
7fe0ac3
remove unused getTime()
ildar170975 Mar 17, 2026
50e86d0
add tests for formatDateTime()
ildar170975 Mar 17, 2026
11b465a
refactor to formatDateTime()
ildar170975 Mar 17, 2026
0007984
styling
ildar170975 Mar 17, 2026
90b55a3
move tests
ildar170975 Mar 17, 2026
0a81b1b
linter
ildar170975 Mar 17, 2026
5288fe1
linter
ildar170975 Mar 17, 2026
37ff80a
linter
ildar170975 Mar 17, 2026
36f9036
linter
ildar170975 Mar 17, 2026
29e11bf
linter
ildar170975 Mar 17, 2026
d38828e
add datetime_format option, use 12h/24h format automatically
ildar170975 Mar 17, 2026
637e709
fix after some fixes in src
ildar170975 Mar 17, 2026
9fd73d4
fix import
ildar170975 Mar 17, 2026
858cff9
fix import in tests
ildar170975 Mar 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ We recommend looking at the [Example usage section](#example-usage) to understan
| color_thresholds | list | | v0.2.3 | Set thresholds for dynamic graph colors, see [Line color object](#line-color-object).
| color_thresholds_transition | string | `smooth` | v0.4.3 | Color threshold transition, `smooth` or `hard`.
| decimals | integer | | v0.0.9 | Specify the exact number of decimals to show for states.
| hour24 | boolean | `false` | v0.2.1 | Set to `true` to display times in 24-hour format.
| hour24 | boolean | | v0.2.1 | Set to `true` to display times in 24-hour format. See more details [here](#custom-format-for-datetime-values).
| datetime_format | string | | v.0.14.0 | Set a custom [format](#custom-format-for-datetime-values) for datetime values.
| font_size | number | `100` | v0.0.3 | Adjust the font size of the state, as percentage of the original size.
| font_size_header | number | `14` | v0.3.1 | Adjust the font size of the header, size in pixels.
| align_header | string | `default` | v0.2.0 | Set the alignment of the header, `left`, `right`, `center` or `default`.
Expand Down Expand Up @@ -258,6 +259,24 @@ These buckets are converted later to single point/bar on the graph. Aggregate fu
| `delta` | v0.9.4 | Calculates difference between max and min value
| `diff` | v0.11.0 | Calculates difference between first and last value

### Custom format for datetime values
By default, the card uses global HA Frontend settings for date & time values. An explicitly defined `datetime_format` option overrides the default format.

Note that the same approach is applied to `hour24` option: if the option is not defined, default settings are used. An explicitly defined `hour24` option overrides the default format.

Here are possible values for the `datetime_format` option:
```
DD/MM/YYYY HH:mm DD.MM.YYYY HH:mm DD-MM-YYYY HH:mm
MM/DD/YYYY HH:mm MM.DD.YYYY HH:mm MM-DD-YYYY HH:mm
YYYY/MM/DD HH:mm YYYY.MM.DD HH:mm YYYY-MM-DD HH:mm
```
where can be used `YYYY` or `YY`, `MM` or `M`, `DD` or `D`, `HH` or `H`.
A singular whitespace must be used to separate date & time formats. Letter case does matter.

Any values which do not match the pattern - lead to a fallback to a "day weekday" format (used as the only and default format till v.0.13).
For clarity, it is recommended to explicitly define a `day_weekday` value in case the legacy "day weekday" format is needed.


### Theme variables
The following theme variables can be set in your HA theme to customize the appearance of the card.

Expand Down
9 changes: 5 additions & 4 deletions src/buildConfig.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { parseDateTimeFormat } from './locale';
import { log } from './utils';
import {
URL_DOCS,
Expand Down Expand Up @@ -111,7 +112,6 @@ export default (config) => {

const conf = {
animate: false,
hour24: false,
font_size: FONT_SIZE,
font_size_header: FONT_SIZE_HEADER,
height: 100,
Expand Down Expand Up @@ -155,9 +155,10 @@ export default (config) => {
conf.color_thresholds,
conf.color_thresholds_transition,
);
const additional = conf.hours_to_show > 24 ? { day: 'numeric', weekday: 'short' } : {};
const hourFormat = conf.hour24 ? { hourCycle: 'h23' } : { hour12: true };
conf.format = { ...hourFormat, ...additional };

// parse a possibly defined "datetime_format" option;
// fallback to "day_weekday" if undefined
conf.datetimeFormatParsed = parseDateTimeFormat(conf.datetime_format);

// override points per hour to mach group_by function
switch (conf.group_by) {
Expand Down
Loading
Loading