Skip to content

Commit

Permalink
feat(span): Add support for isoWeek
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed Mar 1, 2021
1 parent b9c9297 commit 7abc750
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions src/types-config-ti.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -124,6 +126,7 @@ const exportedTypeSuite: t.ITypeSuite = {
ChartCardChartType,
ChartCardBrushExtConfig,
ChartCardSpanExtConfig,
ChartCardStartEnd,
ChartCardAllSeriesExternalConfig,
ChartCardSeriesExternalConfig,
ChartCardPrettyTime,
Expand Down
6 changes: 4 additions & 2 deletions src/types-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7abc750

Please sign in to comment.