sunnyjey
Active Member
I am trying to add timezone (say +2:10 hours) in the date_time field in autofill plugin.
http://fabrikar.com/forums/index.php?wiki/autofill-form-plugin/
As per the above plugin documentation, I can manipulate field using form_X.js
I have tried, but somehow it is not working:
http://fabrikar.com/forums/index.php?wiki/autofill-form-plugin/
As per the above plugin documentation, I can manipulate field using form_X.js
JavaScript:
requirejs(['fab/fabrik'], function() {
Fabrik.addEvent('fabrik.form.autofill.update.start', function(form, data) {
data.table___element = Number(data.table___element).toLocaleString("es-ES", {minimumFractionDigits: 2}); // I DONT KNOW HOW TO ADD HOURS & MINUTES ON THIS LINE
data.table___element_raw = data.table___element;
});
});
I have tried, but somehow it is not working:
JavaScript:
var d = new Date(data.table___element);
d.setHours(d.getHours() + 2);
d.setMinutes(d.getMinutes() + 30);
var dateFormated = d.toJSON().substring(0, 10);
var timeFormated = d.toLocaleTimeString('en-GB');
var dateTimeFormated = dateFormated + ' ' + timeFormated;
data.table___element_raw = dateTimeFormated;