diff --git a/frontend/src/metabase/lib/query_time.js b/frontend/src/metabase/lib/query_time.js index 4988377d07908d26a9c1a457b6ae4e8ce9e44d36..e6e18d2e8300d2d4c005d631b81fc918af9ba576 100644 --- a/frontend/src/metabase/lib/query_time.js +++ b/frontend/src/metabase/lib/query_time.js @@ -1,5 +1,5 @@ import _ from "underscore"; -import moment from "moment"; +import moment from "moment-timezone"; import { assoc } from "icepick"; import inflection from "inflection"; import { t, ngettext, msgid } from "ttag"; diff --git a/frontend/src/metabase/query_builder/components/filters/pickers/DatePicker/SpecificDatePicker.tsx b/frontend/src/metabase/query_builder/components/filters/pickers/DatePicker/SpecificDatePicker.tsx index bdf582e9a91736b15ad18035f675172600f38c1a..c608dd106c778b9fb285e12cb1e058bdb7186bd3 100644 --- a/frontend/src/metabase/query_builder/components/filters/pickers/DatePicker/SpecificDatePicker.tsx +++ b/frontend/src/metabase/query_builder/components/filters/pickers/DatePicker/SpecificDatePicker.tsx @@ -10,6 +10,7 @@ import ExpandingContent from "metabase/components/ExpandingContent"; import HoursMinutesInput from "./HoursMinutesInput"; import moment from "moment"; +import momentTimezone from "moment-timezone"; import { getTimeComponent, setTimeComponent } from "metabase/lib/query_time"; type Props = { @@ -27,7 +28,7 @@ type Props = { const SpecificDatePicker: React.FC<Props> = props => { const onChange = ( - date?: string | moment.Moment, + date?: string | momentTimezone.Moment, hours?: number | null, minutes?: number | null, ) => { @@ -66,7 +67,7 @@ const SpecificDatePicker: React.FC<Props> = props => { onBlurChange={({ target: { value } }: any) => { const date = moment(value, dateFormat); if (date.isValid()) { - onChange(date, hours, minutes); + onChange(date as momentTimezone.Moment, hours, minutes); } else { onChange(); } @@ -100,8 +101,8 @@ const SpecificDatePicker: React.FC<Props> = props => { {calendar && ( <ExpandingContent isOpen={showCalendar}> <Calendar - selected={date} - initial={date || moment()} + selected={date as moment.Moment} + initial={(date as moment.Moment) || moment()} onChange={value => onChange(value, hours, minutes)} isRangePicker={false} selectAll={selectAll}