Skip to content

Commit

Permalink
Dafault time range in 1 year
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Jan 13, 2023
1 parent b1d2930 commit b3a2a5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions movis/src/components/DataRangeComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const DataRangeComp: React.FC = () => {
const handleValueChange = (newValue: DateValueType) => {
if (newValue?.startDate != null && newValue?.endDate != null) {
const d1 = new Date(newValue.endDate);
const d2 = addYears(new Date(newValue.startDate), 2);
const d2 = addYears(new Date(newValue.startDate), 1);
appContext?.setDateRange({
startDate: new Date(newValue.startDate),
endDate: d1 > d2 ? d2 : d1,
Expand All @@ -37,7 +37,7 @@ const DataRangeComp: React.FC = () => {

const maxDate =
appContext?.dateRange.startDate != null
? addYears(new Date(appContext?.dateRange.startDate), 2)
? addYears(new Date(appContext?.dateRange.startDate), 1)
: (new Date("2022-12-31") as Date);

return (
Expand Down
2 changes: 1 addition & 1 deletion movis/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const MyApp: AppType = ({ Component, pageProps }) => {
endDate: Date;
}>({
startDate: new Date("2015-01-01"),
endDate: new Date("2016-12-31"),
endDate: new Date("2015-12-31"),
});

return (
Expand Down

1 comment on commit b3a2a5b

@vercel
Copy link

@vercel vercel bot commented on b3a2a5b Jan 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.