Skip to content

Commit

Permalink
fix date picker start (#5685)
Browse files Browse the repository at this point in the history
* fix date picker start

* make cleaner
  • Loading branch information
phoebemirman authored and bthaile committed Jan 24, 2020
1 parent bc7e341 commit a153c88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Expand Up @@ -397,7 +397,7 @@ export const DatePickerSelector = (props: DatePickerSelectorProps) => {
}}
isOutsideRange={day =>
day.isAfter(moment.unix(isAfter)) ||
day.isBefore(isBefore ? moment.unix(isBefore) : minMarketEndTimeDay())
day.isBefore(isBefore ? moment.unix(isBefore) : minMarketEndTimeDay(currentTimestamp))
}
numberOfMonths={1}
onFocusChange={({ focused }) => {
Expand Down Expand Up @@ -464,7 +464,7 @@ export const DateTimeSelector = (props: DateTimeSelectorProps) => {
onChange('setEndTime', date.startOf('day').unix());
}}
isOutsideRange={day =>
day.isBefore(minMarketEndTimeDay()) ||
day.isBefore(minMarketEndTimeDay(currentTimestamp)) ||
day.isAfter(moment.unix(isAfter))
}
numberOfMonths={1}
Expand Down
6 changes: 2 additions & 4 deletions packages/augur-ui/src/utils/format-date.ts
Expand Up @@ -224,10 +224,8 @@ export function startOfTomorrow(unixTimestamp: number): number {
.unix();
}

export function minMarketEndTimeDay() {
return moment()
.subtract(1, 'day')
.startOf('day');
export function minMarketEndTimeDay(currentTimestamp) {
return moment.unix(currentTimestamp).subtract(1, 'day');
}

export function dateHasPassed(
Expand Down

0 comments on commit a153c88

Please sign in to comment.