Skip to content

Commit

Permalink
Default to current unix timestamp (according to client) if Date Happe…
Browse files Browse the repository at this point in the history
…ned field is empty
  • Loading branch information
big213 committed Apr 15, 2021
1 parent f703d98 commit b8d366c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/models/personalBest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ export const PersonalBest = <RecordInfo<'personalBest'>>{
val && new Date(val * 1000).toISOString().substring(0, 10),
// YYYY-MM-DD to unix timestamp
parseValue: (val: string) => {
// null or falsey values not allowed
if (!val) return undefined
// if falsey, default to current unix timestamp
if (!val) return new Date().getTime() / 1000

const msTimestamp = new Date(val).getTime()
// date cannot be to far in the future
Expand Down

0 comments on commit b8d366c

Please sign in to comment.