|
Title: Datetimebox format - day/month/year HH:MM:SS Post by: A-K on July 20, 2014, 12:22:52 PM Hey,
Im trying to change how the date is shown in the datetimebox but I have a few problems, As I have noticed when I created the formatter and created the format above it didnt work and when I checked why I saw that easyui tries to parse the string he gets from the formatter and since the Date() in js doesnt know how to parse it it just return new Date() in the end. So i overrided the parse function but then I found a problem that I cant create a date with UTC + 2. Any help with this will be much appreciated. Thanks, Alon. Title: Re: Datetimebox format - day/month/year HH:MM:SS Post by: jarry on July 20, 2014, 05:48:08 PM The simple implementation to parse 'day/month/year HH:MM:SS' datetime format shows as below:
Code: $('#dt').datetimebox({Title: Re: Datetimebox format - day/month/year HH:MM:SS Post by: A-K on July 21, 2014, 06:44:33 AM The simple implementation to parse 'day/month/year HH:MM:SS' datetime format shows as below: Code: $('#dt').datetimebox({Thanks so much for the answer! It helped a lot! I would like to add a little fix to the code above because it didnt work right away In the parser there should be another 2 splits and the parser should look like this: parser:function(s){ if (!s){return new Date();} var dt = s.split(' '); var dateFormat = dt[0].split('/'); var timeFormat = dt[1].split(':'); var date = new Date(dateFormat[2],dateFormat[1],dateFormat[0]); if (dt.length>1){ date.setHours(timeFormat[0]); date.setMinutes(timeFormat[1]); date.setSeconds(timeFormat[2]); } return date; } Then everything works just fine! Thanks. |