EasyUI Forum
September 14, 2025, 03:37:47 PM *
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 + Calendar  (Read 13634 times)
lusabo
Newbie
*
Posts: 8


View Profile
« on: March 13, 2012, 07:14:13 AM »

Hi All,

I have a datebox field and I'd like to change the months name on calendar that appears with datebox. How to do it?

$(".campoData").datebox({
  currentText: "Hoje",
  closeText: "Fechar",
  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;
  },
  parser: function(s){
      if (!s) return new Date();
      var ss = s.split('/');
      var d = parseInt(ss[0],10);
      var m = parseInt(ss[1],10);
      var y = parseInt(ss[2],10);
      if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
         return new Date(y,m-1,d);
            } else {
         return new Date();
      }
           }
   });
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: March 13, 2012, 06:51:02 PM »

The datebox is created based on calendar and the month names is defined in calendar.
The easiest way to change the month names is to override the calendar default property:

$.fn.calendar.defaults.months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
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!