vgvinay2 / calendardateselect

Automatically exported from code.google.com/p/calendardateselect
Other
0 stars 0 forks source link

Time picker always use AM/PM format even if time format is 24h #162

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Default installation + format_euro_24hr.js or similar

What is the expected output? What do you see instead?
I need to switch time select box to 24h format without AM/PM postfix.
Instead I get select box with 12 AM/PH hour list.

What version of the product are you using? On what operating system?
1.15

Please provide any additional information below.
I did a quck & dirty patch:
blank_time.concat($R(0,23).map(function(x) {t.setHours(x); return
$A([Date.padded2(t.getHours()),x])} ))

Original issue reported on code.google.com by Arturs.J...@gmail.com on 12 Mar 2009 at 3:16

GoogleCodeExporter commented 9 years ago
Hi,

I second this. I just started using and setting up my calendar_date_select and 
noticed this as well. For a european 
this AM/PM stuff is only confusing.

erik

Original comment by erik.sp...@gmail.com on 5 Dec 2009 at 9:54

GoogleCodeExporter commented 9 years ago
Hi,

version 1.15 btw, been coding away:
added a new option to the options list (line 79):
    // initialize the date control
    this.options = $H({
      embedded: false,
      popup: nil,
      time: false,
      buttons: true,
      clear_button: true,
      year_range: 10,
      close_on_click: nil,
      minute_interval: 5,
      popup_by: this.target_element,
      month_year: "dropdowns",
      onchange: this.target_element.onchange,
      valid_date_check: nil,
      time_12hr: true
    }).merge(options || {});

and added the option to the hr/min select creation (around line 198):

      var t = new Date();
      if (this.options.get("time_12hr")) {
          this.hour_select = new SelectBox(buttons_div,
            blank_time.concat($R(0,23).map(function(x) {t.setHours(x); return $A([t.getAMPMHour()+ " " + 
t.getAMPM(),x])} )),
            { 
              calendar_date_select: this, 
              onchange: function() { this.calendar_date_select.updateSelectedDate( { hour: this.value });},
              className: "hour" 
            }
          );
      } else {
          this.hour_select = new SelectBox(buttons_div,
            blank_time.concat($R(0,23).map(function(x) {t.setHours(x); return $A([t.getHours(),x])} )),
            { 
              calendar_date_select: this, 
              onchange: function() { this.calendar_date_select.updateSelectedDate( { hour: this.value });},
              className: "hour" 
            }
          );
      }

Maybe you can get this in a next version, in an optimized form perhaps ;-)

Original comment by erik.sp...@gmail.com on 5 Dec 2009 at 10:28