Skip to content
Snippets Groups Projects
Commit b83e7f2f authored by Nithya's avatar Nithya
Browse files
Changes updated based on review comments
parent 7ea40adb
No related branches found
No related tags found
1 merge request!374Resolve TMSS-494
......@@ -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;
}
......
......@@ -71,7 +71,7 @@ export default (props) => {
propertyValue.skipFormat = true;
propertyValue.options = {
"inputAttributes": {
"placeholder": "mm/dd/yyyy,--:--:--"
"placeholder": "yyyy-mm-dd,--:--:--"
},
"flatpickr": {
"inlineHideInput": true,
......
......@@ -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
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment