@cccsaurora/howler-ui 2.17.0-dev.533 → 2.17.0-dev.539

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.
@@ -11,12 +11,14 @@ import { useContextSelector } from 'use-context-selector';
11
11
  const CustomSpan = () => {
12
12
  const { t } = useTranslation();
13
13
  const span = useContextSelector(ParameterContext, ctx => ctx.span);
14
- const startDate = useContextSelector(ParameterContext, ctx => (ctx.startDate ? dayjs(ctx.startDate) : null));
14
+ const defaultStartDate = dayjs().subtract(2, 'days');
15
+ const defaultEndDate = dayjs().subtract(1, 'day');
16
+ const startDate = useContextSelector(ParameterContext, ctx => ctx.startDate ? dayjs(ctx.startDate) : defaultStartDate);
15
17
  const setCustomSpan = useContextSelector(ParameterContext, ctx => ctx.setCustomSpan);
16
- const endDate = useContextSelector(ParameterContext, ctx => (ctx.endDate ? dayjs(ctx.endDate) : null));
18
+ const endDate = useContextSelector(ParameterContext, ctx => (ctx.endDate ? dayjs(ctx.endDate) : defaultEndDate));
17
19
  useEffect(() => {
18
- if (span?.endsWith('custom') && (!startDate || !endDate)) {
19
- setCustomSpan(dayjs().subtract(3, 'days').toISOString(), dayjs().toISOString());
20
+ if (span?.endsWith('custom')) {
21
+ setCustomSpan(startDate.format('YYYY-MM-DD HH:mm'), endDate.format('YYYY-MM-DD HH:mm'));
20
22
  }
21
23
  }, [endDate, setCustomSpan, span, startDate]);
22
24
  return span?.endsWith('custom') ? (_jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: _jsxs(Stack, { direction: "row", spacing: 1, useFlexGap: true, flexWrap: "wrap", children: [_jsx(DateTimePicker, { sx: { minWidth: '175px', flexGrow: 1, marginTop: 1 }, slotProps: { textField: { size: 'small' } }, label: t('date.select.start'), value: startDate ? dayjs(startDate) : dayjs().subtract(1, 'days'), maxDate: endDate, onChange: (newStartDate) => setCustomSpan(newStartDate.toISOString(), endDate.toISOString()), ampm: false, disableFuture: true }), _jsx(DateTimePicker, { sx: { minWidth: '175px', flexGrow: 1, marginTop: 1 }, slotProps: { textField: { size: 'small' } }, label: t('date.select.end'), value: endDate, minDate: startDate, onChange: (newEndDate) => setCustomSpan(startDate.toISOString(), newEndDate.toISOString()), ampm: false, disableFuture: true })] }) })) : null;
@@ -25,8 +25,10 @@ const SearchSpan = ({ omitCustom = false, size }) => {
25
25
  const views = useContextSelector(ParameterContext, ctx => ctx.views);
26
26
  const span = useContextSelector(ParameterContext, ctx => ctx.span);
27
27
  const setSpan = useContextSelector(ParameterContext, ctx => ctx.setSpan);
28
- const startDate = useContextSelector(ParameterContext, ctx => (ctx.startDate ? dayjs(ctx.startDate) : null));
29
- const endDate = useContextSelector(ParameterContext, ctx => (ctx.endDate ? dayjs(ctx.endDate) : null));
28
+ const defaultStartDate = dayjs().subtract(2, 'days');
29
+ const defaultEndDate = dayjs().subtract(1, 'day');
30
+ const startDate = useContextSelector(ParameterContext, ctx => ctx.startDate ? dayjs(ctx.startDate) : defaultStartDate);
31
+ const endDate = useContextSelector(ParameterContext, ctx => (ctx.endDate ? dayjs(ctx.endDate) : defaultEndDate));
30
32
  const getCurrentViews = useContextSelector(ViewContext, ctx => ctx.getCurrentViews);
31
33
  useEffect(() => {
32
34
  if (location.search.includes('span')) {
package/package.json CHANGED
@@ -101,7 +101,7 @@
101
101
  "internal-slot": "1.0.7"
102
102
  },
103
103
  "type": "module",
104
- "version": "2.17.0-dev.533",
104
+ "version": "2.17.0-dev.539",
105
105
  "exports": {
106
106
  "./i18n": "./i18n.js",
107
107
  "./index.css": "./index.css",