I'm using the pretty good eternicode's/bootstrap-datepicker jQuery plugin.
I'm trying to use the included DPGlobal tools to do some date operations.
Example:
dpg = $.fn.datepicker.DPGlobal;
date_format = 'dd/mm/yyyy';
date_str = '31/12/2013';
console.log(dpg.parseDate(start, date_format));
returns me (on firefox)
TypeError: format.parts is undefined
What am I doing wrong ?
Check out my fiddleable example
You also have to parse the format before you use parseDate(...)
:) .
dpg.parseDate(date_str, dpg.parseFormat(date_format))
I've updated your fiddle.
You need to parse the format
first using parseFormat(format)
$('body').append($('<div />').text(dpg.parseDate(date_str, dpg.parseFormat(date_format))));
Demo: Plunker
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With