diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js index 314300184642fc4ed73d10a227800d40b0890904..c339a9188b3d05ec397c392418c6d94018e31b44 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js @@ -8,6 +8,7 @@ import _ from 'lodash'; import UnitConverter from '../../utils/unit.converter' import $RefParser from "@apidevtools/json-schema-ref-parser"; import "@fortawesome/fontawesome-free/css/all.css"; +import flatpickr from 'flatpickr'; import "flatpickr/dist/flatpickr.css"; const JSONEditor = require("@json-editor/json-editor").JSONEditor; @@ -148,7 +149,7 @@ function Jeditor(props) { errors.push({ path: path, property: 'validationType', - message: 'Not a valid input. Mimimum: 00:00:00.0000, Maximum:23:59:59.0000' + message: 'Not a valid input. Mimimum: 00:00:00.0000, Maximum:23:59:59.9999' }); } } else if (schema.validationType === "angle") { @@ -156,7 +157,7 @@ function Jeditor(props) { errors.push({ path: path, property: 'validationType', - message: 'Not a valid input. Mimimum: 00:00:00.0000, Maximum:90:00:00.0000' + message: 'Not a valid input. Mimimum: 00:00:00.0000, Maximum:90:00:00.9999' }); } } else if (schema.validationType === "distanceOnSky") { @@ -260,12 +261,12 @@ function Jeditor(props) { options: { "grid_columns": 4, "inputAttributes": { - "placeholder": isDegree?"DD:mm:ss.ms":"HH:mm:ss:ms" + "placeholder": isDegree?"DD:mm:ss.ssss":"HH:mm:ss.ssss" }, "cleave": { numericOnly: true, blocks: [2, 2, 2, 4], - delimiters: isDegree ? [':', ':','.'] : [':', ':', ':'], + delimiters: isDegree ? [':', ':','.'] : [':', ':', '.'], delimiterLazyShow: true } } @@ -440,12 +441,12 @@ function Jeditor(props) { */ function validateTime(prpOutput) { const splitOutput = prpOutput.split(':'); - const isMilliSecondsPresent = splitOutput[3]; - if (splitOutput.length < 3 || (isMilliSecondsPresent[1] && isMilliSecondsPresent[1].length > 4)) { + if (splitOutput.length < 3) { // if (splitOutput.length < 3) { return false; } else { - if (parseInt(splitOutput[0]) > 23 || parseInt(splitOutput[1])>59 || parseInt(splitOutput[2])>59) { + if (parseInt(splitOutput[0]) > 23 || parseInt(splitOutput[1])>59 || parseInt(splitOutput[2])>59 ) + { return false; } const timeValue = parseInt(splitOutput[0]*60*60) + parseInt(splitOutput[1]*60) + parseInt(splitOutput[2]*1000); @@ -462,15 +463,13 @@ function Jeditor(props) { */ function validateAngle(prpOutput) { const splitOutput = prpOutput.split(':'); - const isMilliSecondsPresent = prpOutput.split('.'); - if (splitOutput.length < 3 || isMilliSecondsPresent[1].length > 4) { - //if (splitOutput.length < 3) { + if (splitOutput.length < 3) { return false; } else { - if (parseInt(splitOutput[0]) > 90 || parseInt(splitOutput[1])>59 || parseInt(splitOutput[2])>59 || parseInt(splitOutput[3])>999) { + if (parseInt(splitOutput[0]) > 90 || parseInt(splitOutput[1])>59 || parseInt(splitOutput[2])>59) { return false; } - const timeValue = parseInt(splitOutput[0]*60*60) + parseInt(splitOutput[1]*60) + parseInt(splitOutput[2]*1000 + parseInt(splitOutput[3])); + const timeValue = parseInt(splitOutput[0]*60*60) + parseInt(splitOutput[1]*60) + parseInt(splitOutput[2]*1000); if (timeValue > 324000) { return false; } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js index ff0ccab1672f0096ae615e8aa29006dfe1d81436..caad1b2674ba053b40a00a11b7eaeee1fc99cd08 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js @@ -71,7 +71,7 @@ export default (props) => { propertyValue.skipFormat = true; propertyValue.options = { "inputAttributes": { - "placeholder": "mm/dd/yyyy,--:--:--" + "placeholder": "yyyy-mm-dd,--:--:--" }, "flatpickr": { "inlineHideInput": true, diff --git a/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js b/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js index 4b848390ed0e59935f18e676863cf763c24dd306..a409966edcf23ba2494b4500daa12cc1249c0804 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js @@ -106,7 +106,7 @@ const UnitConverter = { if (isDegree) { return ((splitOutput[0]*1 + splitOutput[1]/60 + splitOutput[2].split('.')[0]/3600 + milliSeconds/36000000)*Math.PI/180); } else { - return ((splitOutput[0]*15 + splitOutput[1]/4 + splitOutput[2]/240 + splitOutput[3]/2400000)*Math.PI/180); + return ((splitOutput[0]*15 + splitOutput[1]/4 + splitOutput[2].split('.')[0]/240 + milliSeconds/2400000)*Math.PI/180); } }else{ return "00:00:00.0000"; @@ -114,7 +114,7 @@ const UnitConverter = { }, /** - * Function to add leading zeros in end + * Function to add trailing zeros in end * @param {*} number * @param {*} digits */