Editor Date UI Widget only goes back to 1998, Help!
Editor Date UI Widget only goes back to 1998, Help!
Ok, this is not an error because my examples and yours only go back to 1998 as well which makes it impossible to add a birthdate let alone create a calculation for it
First:
}, {
label: "Birthday:",
name: "abo.Contributors.Birthday",
type: 'datetime',
// def: function () { return new Date(); },
displayFormat: "M/D/YYYY",
wireFormat: "YYYY-MM-DD",
fieldInfo: "US style m/d/y format",
keyInput: true
}, {
Will not let me enter a date outside of the UI Widget's date range, which only goes to 1998, how to fix?
Also: If I enter a date with a year earlier than 1998 I get this console error:
dataTables.editor.min.js:6 Field is still processing For more information, please refer to https://datatables.net/tn/16
The problem was found because I am using the birthdate to calculate the age in the editor.
editor.dependent( 'abo.Contributors.Age', function ( val ) {
if(editor.field('abo.Contributors.Birthday').val() !== '' )
{
var dob = editor.field('abo.Contributors.Birthday').val();
var dob = new Date(dob);
var date1 = dob.getTime()/ (365.25 * 24 * 60 * 60 * 1000);
var today =new Date();
var date2 = today.getTime()/ (365.25 * 24 * 60 * 60 * 1000);
var age = Math.round(date2 - date1);
editor.field('abo.Contributors.Age').val(age);
}
} );
Thanks so much!
This question has an accepted answers - jump to answer
Answers
The date picker has a
yearRange
option which is default 25 - hence the range you see. You can change that property to increase it - e.g. add:You might want to add a
maxDate
as well to limit the dates going forward.Allan
TYSM!