Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI bugfix for the date formatting in Chart being incorrect (#2173)

Wouter Voorberg0f1f2c59c35c
diff --git a/ui/component/or-attribute-barchart/src/index.ts b/ui/component/or-attribute-barchart/src/index.ts
index 7d8d229c8..b0452b7c3 100644
--- a/ui/component/or-attribute-barchart/src/index.ts
+++ b/ui/component/or-attribute-barchart/src/index.ts
@@ -1246,9 +1246,9 @@ export class OrAttributeBarChart extends LitElement {
interval: this._intervalConfig?.millis,
fontSize: 10,
formatter: {
- year: "{yyyy}",
- month: "{MMMM} '{yy}",
- day: "{MMM} {d}th",
+ year: "1-{MMM}-{yyyy}",
+ month: "1-{MMM}-'{yy}",
+ day: "{d}-{MMM}",
hour: "{HH}:{mm}",
minute: "{HH}:{mm}",
second: "{HH}:{mm}:{ss}",
diff --git a/ui/component/or-attribute-history/src/index.ts b/ui/component/or-attribute-history/src/index.ts
index 99f9756aa..e09902e45 100644
--- a/ui/component/or-attribute-history/src/index.ts
+++ b/ui/component/or-attribute-history/src/index.ts
@@ -438,15 +438,15 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {
hideOverlap: true,
fontSize: 10,
formatter: {
- year: '{yyyy}-{MMM}',
- month: '{yy}-{MMM}',
- day: '{d}-{MMM}',
- hour: '{HH}:{mm}',
- minute: '{HH}:{mm}',
- second: '{HH}:{mm}:{ss}',
- millisecond: '{d}-{MMM} {HH}:{mm}',
+ year: "1-{MMM}-{yyyy}",
+ month: "1-{MMM}-'{yy}",
+ day: "{d}-{MMM}",
+ hour: "{HH}:{mm}",
+ minute: "{HH}:{mm}",
+ second: "{HH}:{mm}:{ss}",
+ millisecond: "{d}-{MMM} {HH}:{mm}",
// @ts-ignore
- none: '{MMM}-{dd} {HH}:{mm}'
+ none: "{MMM}-{dd} {HH}:{mm}"
}
}
},
diff --git a/ui/component/or-chart/src/index.ts b/ui/component/or-chart/src/index.ts
index e19349d14..5746451c2 100644
--- a/ui/component/or-chart/src/index.ts
+++ b/ui/component/or-chart/src/index.ts
@@ -619,8 +619,8 @@ export class OrChart extends translate(i18next)(LitElement) {
hideOverlap: true,
fontSize: 10,
formatter: {
- year: "{yyyy}-{MMM}",
- month: "{yy}-{MMM}",
+ year: "1-{MMM}-{yyyy}",
+ month: "1-{MMM}-'{yy}",
day: "{d}-{MMM}",
hour: "{HH}:{mm}",
minute: "{HH}:{mm}",