datetimepicker icon indicating copy to clipboard operation
datetimepicker copied to clipboard

$.datetimepicker.setDateFormatter is not a function

Open johnrobertallan opened this issue 9 years ago • 2 comments

This method is mentioned in the documentation, does it not longer exist? Happy to help update the documentation if that's the case. (too bad though, would be useful) Thanks for the plugin.

johnrobertallan avatar Sep 27 '16 20:09 johnrobertallan

Can you try using jQuery.datetimepicker.setDateFormatter? I had an issue with $.datetimepicker.setLocale('en'); and had to use jQuery.datetimepicker.setLocale('en'); as displayed in http://xdsoft.net/jqplugins/datetimepicker/ as well. Don't exactly know why, since I think that shouldn't make a difference at all, but maybe that's a general issue

TPei avatar Sep 28 '16 10:09 TPei

Can you try using jQuery.datetimepicker.setDateFormatter? I had an issue with $.datetimepicker.setLocale('en'); and had to use jQuery.datetimepicker.setLocale('en'); as displayed in http://xdsoft.net/jqplugins/datetimepicker/ as well. Don't exactly know why, since I think that shouldn't make a difference at all, but maybe that's a general issue

Hello. Try to insert this code BEFORE dom-element datetimepicker initialisation. `$.datetimepicker.setLocale('en'); $.datetimepicker.setDateFormatter({ parseDate: function (date, format) { let d = moment(date, format); return d.isValid() ? d.toDate() : false; },

	formatDate: function (date, format) {
		return moment(date).format(format);
	},

	//Optional if using mask input
	formatMask: function(format){
		return format
			.replace(/Y{4}/g, '9999')
			.replace(/Y{2}/g, '99')
			.replace(/M{2}/g, '19')
			.replace(/D{2}/g, '39')
			.replace(/H{2}/g, '29')
			.replace(/m{2}/g, '59')
			.replace(/s{2}/g, '59');
	}
});`

vaste2408 avatar Dec 13 '19 01:12 vaste2408