diff --git a/README.md b/README.md index 501006b..45b65f4 100644 --- a/README.md +++ b/README.md @@ -256,8 +256,8 @@ The position of the marker will only update when the card updates (state change | Name | Since | Description | | ---- | :---: | ----------- | -| `start` | v1.2.0 | Display the graph from the begining of the `minute`, `day`, `hour`, `week`, `month`, `year` | -| `end` | v1.2.0 | Display the graph from the end of the `minute`, `day`, `hour`, `week`, `month`, `year` | +| `start` | v1.2.0 | Display the graph from the begining of the `minute`, `day`, `hour`, `week`, `month`, `year`, `isoWeek`. `isoWeek` is the start of the week according to ISO 8601 | +| `end` | v1.2.0 | Display the graph from the end of the `minute`, `day`, `hour`, `week`, `month`, `year`, `isoWeek`. `isoWeek` is the end of the week according to ISO 8601 | | `offset` | v1.2.0 | Offset the graph by an amount of time. To offset in the past, start with `-`. Eg. of valid values: `-1day`, `-12h`, `12h`, `30min`, ... `month` (365.25 days / 12) and `year` (365.25 days) as unit will generate inconsistent result, you should use days instead. | Span enables you to: diff --git a/src/types-config-ti.ts b/src/types-config-ti.ts index a9d5d54..06c6a57 100644 --- a/src/types-config-ti.ts +++ b/src/types-config-ti.ts @@ -50,11 +50,13 @@ export const ChartCardBrushExtConfig = t.iface([], { }); export const ChartCardSpanExtConfig = t.iface([], { - "start": t.opt(t.union(t.lit('minute'), t.lit('hour'), t.lit('day'), t.lit('week'), t.lit('month'), t.lit('year'))), - "end": t.opt(t.union(t.lit('minute'), t.lit('hour'), t.lit('day'), t.lit('week'), t.lit('month'), t.lit('year'))), + "start": t.opt("ChartCardStartEnd"), + "end": t.opt("ChartCardStartEnd"), "offset": t.opt("string"), }); +export const ChartCardStartEnd = t.union(t.lit('minute'), t.lit('hour'), t.lit('day'), t.lit('week'), t.lit('month'), t.lit('year'), t.lit('isoWeek')); + export const ChartCardAllSeriesExternalConfig = t.iface([], { "entity": t.opt("string"), "attribute": t.opt("string"), @@ -124,6 +126,7 @@ const exportedTypeSuite: t.ITypeSuite = { ChartCardChartType, ChartCardBrushExtConfig, ChartCardSpanExtConfig, + ChartCardStartEnd, ChartCardAllSeriesExternalConfig, ChartCardSeriesExternalConfig, ChartCardPrettyTime, diff --git a/src/types-config.ts b/src/types-config.ts index 62ad498..432d68c 100644 --- a/src/types-config.ts +++ b/src/types-config.ts @@ -49,11 +49,13 @@ export interface ChartCardBrushExtConfig { } export interface ChartCardSpanExtConfig { - start?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; - end?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; + start?: ChartCardStartEnd; + end?: ChartCardStartEnd; offset?: string; } +export type ChartCardStartEnd = 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' | 'isoWeek'; + export interface ChartCardAllSeriesExternalConfig { entity?: string; attribute?: string;