From c2b0b65eed078da0d783714c54cb7d985eb99da2 Mon Sep 17 00:00:00 2001 From: Tobias Nteireho Date: Wed, 14 Feb 2024 14:11:34 -0600 Subject: [PATCH] use denormalize max and min --- src/mobile/pages/fields/field/field.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/mobile/pages/fields/field/field.js b/src/mobile/pages/fields/field/field.js index 4b79b0a0..e8231283 100644 --- a/src/mobile/pages/fields/field/field.js +++ b/src/mobile/pages/fields/field/field.js @@ -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