I've seen something here posted by toms but before I apply .... it's gone. anyway...
To get the current date in the form field I put this code in javascript...
function mysqlDate(date){
date = date || new Date();
var dd = date.getDate();
var mm = date.getMonth()+1;
var yyyy = date.getFullYear();
if(dd<10) {
dd='0'+dd
}
if(mm<10) {
mm='0'+mm
}
return dd + "." + mm + "." + yyyy; //--ex. 07.03.2018
}
... then at the event in the object I put this (onfocus)
var d = new Date();
var f = d.getFullYear() + '-' + nuPad2(d.getMonth() + 1) + '-' + nuPad2(d.getDate());
var n = $('#cus_date').attr('data-nu-format');
var v = nuFORM.addFormatting(f, n);
$('#cus_date').val(v).change();
All 3 variants (2 Steven and 1 toms) we tested and worked perfectly !!!
I would come up with an 'IF' for version 2 (Steven) for those who do not want to add the date automatically when it exists (useful when the form exists and just edits). Thanks Steve and toms for help and work done.
var d = new Date();
var f = d.getFullYear() + '-' + nuPad2(d.getMonth() + 1) + '-' + nuPad2(d.getDate());
var n = $('#cus_date').attr('data-nu-format');
var v = nuFORM.addFormatting(f, n);
if ( $('#cus_date').val() == '0' || $('#cus_date').val() == '' || $('#cus_date').val() == 'undefined' || $('#cus_date').val() == null )
$('#cus_date').val(v).change();