@ledvance/ui-biz-bundle 1.1.99 → 1.1.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.99",
7
+ "version": "1.1.100",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -82,6 +82,7 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
82
82
  useUpdateEffect(() => {
83
83
  state.over365Days = overDays(state.date, 365);
84
84
  state.over7Days = overDays(state.date, 7);
85
+ updateHeadlineText(dayjs(state.date));
85
86
  state.loading = true;
86
87
  getElectricity(devId, addEleDpCode, state.date, state.dateType).then((res) => {
87
88
  state.chartData = res;
@@ -99,25 +100,38 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
99
100
  return I18n.getLang('energyconsumption_emptydata')
100
101
  }, [state.dateType, state.over365Days, state.over7Days]);
101
102
 
103
+ const updateHeadlineText = useCallback((date: dayjs.Dayjs) => {
104
+ const year = date.year().toString();
105
+ const month = (date.month() + 1).toString().padStart(2, '0');
106
+ const day = date.date().toString().padStart(2, '0');
107
+ const dayOfWeek = date.day() % 7;
108
+ switch (state.dateType) {
109
+ case DateType.Year:
110
+ state.headlineText = year;
111
+ break
112
+ case DateType.Month:
113
+ state.headlineText = `${monthFormat(month)} ${year}`;
114
+ break
115
+ case DateType.Day:
116
+ state.headlineText = `${day}/${month}/${year}\n${loopsText[dayOfWeek]}`;
117
+ break
118
+ }
119
+ }, [state.dateType, state.headlineText]);
102
120
 
103
121
  useUpdateEffect(() => {
104
122
  const date = dayjs();
105
123
  const year = date.year().toString();
106
124
  const month = (date.month() + 1).toString().padStart(2, '0');
107
125
  const day = date.date().toString().padStart(2, '0');
108
- const dayOfWeek = date.day() % 7;
109
126
  switch (state.dateType) {
110
127
  case DateType.Year:
111
128
  state.date = year;
112
- state.headlineText = year;
113
129
  break
114
130
  case DateType.Month:
115
131
  state.date = `${year}${month}`
116
- state.headlineText = `${monthFormat(month)} ${year}`;
117
132
  break
118
133
  case DateType.Day:
119
134
  state.date = `${year}${month}${day}`
120
- state.headlineText = `${day}/${month}/${year}\n${loopsText[dayOfWeek]}`;
121
135
  break
122
136
  }
123
137
  }, [state.dateType]);