Skip to content

Commit

Permalink
Date Happened field on personalBest must not be too far in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
big213 committed Apr 9, 2021
1 parent da8b76d commit 2e594e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

.truncate-mobile-row {
max-width: 50%;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/page/crudRecordPage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-container fluid>
<v-container fluid style="max-width: 1920px">
<v-layout column justify-left align-left>
<v-row>
<v-col cols="12">
Expand Down
9 changes: 8 additions & 1 deletion frontend/models/personalBest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,14 @@ export const PersonalBest = <RecordInfo<'personalBest'>>{
parseValue: (val: string) => {
// null or falsey values not allowed
if (!val) throw new Error(`Invalid value for Date Happened`)
return new Date(val).getTime() / 1000

const msTimestamp = new Date(val).getTime()
// date cannot be to far in the future
if (msTimestamp > new Date().getTime() + 1000 * 60 * 60 * 24) {
throw new Error(`Date Happened cannot be in the future`)
}

return msTimestamp / 1000
},
},
'createdBy.id': {
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/public-pbs.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<v-container fluid class="text-center pb-0">
<v-container fluid class="text-center pb-0" style="max-width: 1920px">
<v-progress-circular
v-if="loading.presets"
indeterminate
Expand Down

0 comments on commit 2e594e9

Please sign in to comment.