msyavuz commented on code in PR #31019:
URL: https://github.com/apache/superset/pull/31019#discussion_r1915930076
##########
superset-frontend/src/components/ListView/Filters/DateRange.tsx:
##########
@@ -51,40 +54,47 @@ function DateRangeFilter(
ref: RefObject<FilterHandler>,
) {
const [value, setValue] = useState<ValueState | null>(initialValue ?? null);
- const momentValue = useMemo((): [Moment, Moment] | null => {
+ const dayjsValue = useMemo((): [Dayjs, Dayjs] | null => {
if (!value || (Array.isArray(value) && !value.length)) return null;
- return [moment(value[0]), moment(value[1])];
+ return [extendedDayjs(value[0]), extendedDayjs(value[1])];
}, [value]);
+ const locale = useLocale();
+
useImperativeHandle(ref, () => ({
clearFilter: () => {
setValue(null);
onSubmit([]);
},
}));
+ if (locale === null) {
+ return <Loading position="inline-centered" />;
+ }
return (
- <RangeFilterContainer>
- <FormLabel>{Header}</FormLabel>
- <RangePicker
- placeholder={[t('Start date'), t('End date')]}
- showTime
- value={momentValue}
- onChange={momentRange => {
- if (!momentRange) {
- setValue(null);
- onSubmit([]);
- return;
- }
- const changeValue = [
- momentRange[0]?.valueOf() ?? 0,
- momentRange[1]?.valueOf() ?? 0,
- ] as ValueState;
- setValue(changeValue);
- onSubmit(changeValue);
- }}
- />
- </RangeFilterContainer>
+ <AntdThemeProvider locale={locale}>
Review Comment:
I did that because I don't know if modifying global theme provider is
something we want. Some components might not want to be localized.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]