Skip to content

Commit

Permalink
allow for pm times to be entered
Browse files Browse the repository at this point in the history
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
  • Loading branch information
maia-iyer committed Aug 9, 2021
1 parent f1cbf9f commit bbcc590
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tornjak-frontend/src/components/entry-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,16 @@ class CreateEntry extends Component {
});
}

onChangeExpiryOption(e) { //TODO try date=date
onChangeExpiryOption(e) {
this.setState({
expiresAt: 0,
expiryOption: e.selectedItem
});
}

isValidJSTime(seconds) {
return seconds > 0 && seconds <= 8640000000000 //TODO clean
const JSMaxSafeTime = 8640000000000
return seconds > 0 && seconds <= JSMaxSafeTime
}

expiryTimeUpdate(seconds) {
Expand All @@ -245,7 +246,8 @@ class CreateEntry extends Component {
this.expiryTimeUpdate(seconds)
}

isValidDate(d) {
// TODO some odd behavior with dates like February 33 exists
isValidDate(d) { // date is successfully translated
return d instanceof Date && isFinite(d)
}

Expand Down Expand Up @@ -702,16 +704,15 @@ class CreateEntry extends Component {
placeholder="mm/dd/yyyy"
labelText="Enter a date"
onChange={this.onChangeExpiresAtDate}
required
/>
</DatePicker>
</div>
<div className="expiryOption-entry">
<TimePicker
labelText="Enter local time (15:45)"
placeholder="hh:mm"
pattern={["^([0-1]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"]} // Allows
onChange={this.onChangeExpiresAtTime}
required
>
</TimePicker>
</div>
Expand Down

0 comments on commit bbcc590

Please sign in to comment.