Skip to content

Commit

Permalink
use denormalize max and min
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasnteireho committed Feb 14, 2024
1 parent 9bb801a commit c2b0b65
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/mobile/pages/fields/field/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,24 @@ export const FieldVM = DefineMap.extend('FieldVM', {



if (Date.parse(value) < Date.parse(normalizeDateInput(field.min))){
let maxDate = Date.parse(
field.max.substr(0,2) + "/" +
field.max.substr(2,2) + "/" +
field.max.substr(4))

let minDate = Date.parse(
field.min.substr(0,2) + "/" +
field.min.substr(2,2) + "/" +
field.min.substr(4))



if (Date.parse(value) < minDate){
console.log("smaller")
value = field.min
} else if (Date.parse(value) > Date.parse(normalizeDateInput(field.max))){
value = minDate //field.min
} else if (Date.parse(value) > maxDate){
console.log("bigger")
value = field.max
value = maxDate //field.max
}

// render formatted date for end user
Expand Down

0 comments on commit c2b0b65

Please sign in to comment.