Skip to content

Commit efac8e4

Browse files
authored
Merge pull request #5687 from cloudforet-io/hotfix-widget-date-range
fix(widget-date-range): apply date-range api query policy
2 parents b529bb0 + 26558a7 commit efac8e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/web/src/common/modules/widgets/_composables/use-widget-date-range.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const useWidgetDateRange = (options: UseWidgetDateRangeOptions): UseWidge
3939
const state = reactive<UseWidgetDateRangeState>({
4040
granularity: computed<GranularityValue['granularity']>(() => _granularityInfo.value?.granularity ?? 'MONTHLY'),
4141
isInherit: computed<boolean>(() => !!options.dateRangeFieldValue.value?.inherit),
42-
dateRangeOptions: computed<DateRangeValue['options']>(() => options.dateRangeFieldValue.value?.options || 'auto'),
42+
dateRangeOptions: computed<DateRangeValue['options']>(() => options.dateRangeFieldValue.value?.options || { value: 'auto' }),
4343
baseOnDate: computed<string|undefined>(() => (state.isInherit ? _baseOnDate.value : undefined)),
4444
dateRange: computed<DateRange>(() => {
4545
const dateRangePresetKey = state.dateRangeOptions?.value || 'auto';
@@ -123,7 +123,7 @@ export const useWidgetDateRange = (options: UseWidgetDateRangeOptions): UseWidge
123123
const _date = baseDate.date();
124124
const isEndOfMonth = _date === baseDate.endOf('month').date();
125125

126-
_start = baseDate.subtract(isEndOfMonth ? baseMonthDayCount - 1 : 29, 'day').format('YYYY-MM-DD');
126+
_start = isEndOfMonth ? baseDate.subtract(baseMonthDayCount - 1, 'day').format('YYYY-MM-DD') : baseDate.subtract(1, 'month').add(1, 'day').format('YYYY-MM-DD');
127127
_end = baseDate.format('YYYY-MM-DD');
128128
} else if (relativeDateRangeValue === 'today') {
129129
_start = baseDate.format('YYYY-MM-DD');

0 commit comments

Comments
 (0)