ICEfaces
  1. ICEfaces
  2. ICE-10918

ace:dateTimeEntry "Now" button should honor timeZone attribute

    Details

    • Assignee Priority:
      P2
    • Support Case References:
      Support Case 13652:-https://icesoft.my.salesforce.com/5007000001XOeY6

      Description

      Currently when using the popup version of the ace:dateTimeEntry widget, the "Now" button does not honor the timeZone entry.
      change Showcase "popup" example of this component to:-
            <h:panelGrid style="margin-left: auto; margin-right: auto; text-align: center;" width="100">
                          <ace:dateTimeEntry id="cal"
                                                         value="#{datePopup.selectedDate}"
                                                         timeZone="#{datePopup.selectedTimeZone} "
                                                         pattern="MMM/dd/yyyy hh:mm z"
                                                         renderAsPopup="#{datePopup.popup}">
                           </ace:dateTimeEntry>
                          <h:commandButton id="submit" value="Submit Date"/>

      and allow the user to select a timeZone:-
                          <h:panelGroup>
                              <h:outputLabel for="tzinput" value="Select TimeZone:-"/>
                              <h:selectOneMenu id="tzinput" value="#{datePopup.selectedTimeZone}">
                                  <f:selectItems value="#{datePopup.timeZones}"/>
                              </h:selectOneMenu>
                          </h:panelGroup>

      ....
      with DatePopupBean:-

      (in constructor)...

              String[] ids = TimeZone.getAvailableIDs();
              for (String id : ids){
                  timeZones.add(new SelectItem(id, displayTimeOffset(id) ));
              }

         public String displayTimeOffset(String id){
              TimeZone zone = TimeZone.getTimeZone(id);
              long hours = TimeUnit.MILLISECONDS.toHours(zone.getRawOffset());
      long minutes = TimeUnit.MILLISECONDS.toMinutes(zone.getRawOffset())
                                        - TimeUnit.HOURS.toMinutes(hours);
      minutes = Math.abs(minutes);
      String result = "";
              String hrs = String.valueOf(hours) ;
           // System.out.println(" hours="+hours+" hrs="+hrs);
      if (hours > 0) {
      result = "(GMT+"+hrs+":"+hrs+") "+ String.valueOf(minutes);
      } else {
      result = "(GMT"+hrs+":"+hrs+")"+ String.valueOf(minutes);
      }

      return result;
          }
      ...
      when you use the "now" button on the popup of the widget, you can change the timeZone and then select a time, but the "Now" button will always reflect the "Now" for the browser locale.
      Should this not reflect the "Now" in the timeZone that is currently selected? OTherwise, do we improve it to have another attribute that forces this?
      1. datepopup.xhtml
        3 kB
        Carmen Cristurean
      2. DatePopupBean.java
        3 kB
        Carmen Cristurean
      1. 1.PNG
        266 kB
      2. 2.PNG
        169 kB

        People

        • Assignee:
          Arturo Zambrano
          Reporter:
          Judy Guglielmin
        • Votes:
          0 Vote for this issue
          Watchers:
          4 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: