neil_lindberg
5 years agoCreator III
ERROR: client-side validation method: (intermediate value).format is not a function
I can't figure this out. I simply want a ... ceiling on a calendar input value.What is happening to this? I can take the same passed value and do the same operation in Chrome dev tools and it works perfectly as expected.
What is Innovator doing here? It logs the inputTime, as a number, and I can take the same value and pass it to the same formatting function outside of this onChange listener function.
/*
@description: Date must be <= today
@params: this [form element]
*/
// Clean clone of value prop, disconnecting any reference.
// const value = JSON.parse(JSON.stringify(this.value));
console.log('BL_NotTomorrow');
const inn = new Innovator();
const fieldMap = {
pr_found_date: 'Problem Report found date',
created_on: 'Opened Date'
};
const {value, name} = this;
console.log('name/value: ', name, value);
const inputTime = new Date(value).getTime();
console.log(typeof inputTime, inputTime);
const now = Date.now();
let formatted, error;
try {
// FIXME: sees error TypeError: (intermediate value).format is not a function
/*
Yet in dev tools with simple expression that should match the following we have no problems:
new Date(1595221200000).format('MM/dd/yyyy')
"07/20/2020"
*/
formatted = new Date(inputTime).format('MM/dd/yyyy');
console.log("END TRY");
}catch (e) {
error = e.name + ': ' + e.message;
}
console.log('formatted, inputTime, now: ', formatted, inputTime, now);
console.log(error ? 'sees error':'does not see error', error); // sees error every time.
if (error) {
this.value = '';
return aras.AlertError(inn.newError(`ERROR > ${error}`));
} else {
this.value = formatted;
return (inputTime > now) ? inn.newError(`Value of ${fieldMap[name] || 'calendar'} must be in the past.`) : this;
}
^^^^^End code, but you wouldn't know because this editor is as unfriendly as the code editor. Who wants to tab from the title to the print button!? Why would you have tabIndexes on your main form inputs like 128 and 256!? Everything about this thing takes extra time. Goodness gracious. Aras Innovator is going to kill me.