Skip to content

Commit

Permalink
wip date bounds enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasnteireho committed Feb 12, 2024
1 parent a356a27 commit 690b64e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/mobile/pages/fields/field/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,19 @@ export const FieldVM = DefineMap.extend('FieldVM', {
} else if (field.type === 'useravatar') { // TODO: validate the JSON string here?
value = JSON.stringify(this.userAvatar.serialize())
} else if (field.type === 'datemdy') {

// format date to (mm/dd/yyyy) from acceptable inputs
value = this.normalizeDateInput($el.val())
// render formatted date for end user

if (Date.parse(value) < Date.parse(field.min)){
value = field.min
} else if (Date.parse(value) > Date.parse(field.max)){
value = field.min
}



$el.val(value)
} else {
value = $el.val()
Expand Down

0 comments on commit 690b64e

Please sign in to comment.