EasyUI Forum
September 14, 2025, 06:29:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: datebox's calendar shows wrong date  (Read 12577 times)
ikaurov
Newbie
*
Posts: 4


View Profile Email
« on: November 04, 2013, 10:33:23 PM »

Hello All !

I would like to display date in datebox as "dd.mm.yyyy" .

It works fine until I call calendar: "01.11.2013" becomes 11th January instead of 1st of November.
Please advise what am I miss.
Thanks, Ilya
Logged
acreonte82
Jr. Member
**
Posts: 85



View Profile
« Reply #1 on: November 05, 2013, 01:24:18 AM »

Post your code...
Logged
ikaurov
Newbie
*
Posts: 4


View Profile Email
« Reply #2 on: November 05, 2013, 02:09:02 AM »


Code:
<input id="f_d1" type="text" class="easyui-datebox" value="01.11.2013">

<script>
$.fn.datebox.defaults.formatter = function(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
return (d<10?('0'+d):d)+'.'+(m<10?('0'+m):m)+'.'+y;
}
</script>
Logged
ikaurov
Newbie
*
Posts: 4


View Profile Email
« Reply #3 on: November 07, 2013, 01:00:26 AM »

For what it worst, I end up with writing function set_calendar which move calendar to right date
at start  and each time when calendar is picked
Code:

$('#dd').datebox({
onSelect: function(date){
set_calendar(date.getFullYear(), date.getMonth(), date.getDate());
}
});

function set_calendar(y, m, d) {
     var el = $('#dd').datebox('calendar');
     el.calendar('moveTo', new Date(y, m, d));
}
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!