Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DateTime timezone in UTC

    Hello,

    I am using the following:
    GWT 2.4.0
    smartgwt 3.0
    Firefox 5.0

    I want all the date time show in UTC timezone so I set DateUtil.setDefaultDisplayTimezone("+00:00") at the beginnning however, when I click on the date chooser, it still highlights the browser's local date (8/23) and also when I click the today day, it shows 2012/08/23 00:00. The Browser's local time is 8/23/2012 6:57 PM Pacific Time which should be 8/24/2012 01:57 UTC

    Here's the very simple test case that has only one start datetime field in the form and does not show the UTC date in the date chooser:

    public void onModuleLoad() {

    DateUtil.setNormalDateDisplayFormat(DateDisplayFormat.TOSERIALIZEABLEDATE);
    DateUtil.setNormalDateDisplayFormatter(new DateDisplayFormatter() {
    public String format(Date date) {
    if(date == null) return null;
    final DateTimeFormat dateFormatter = DateTimeFormat.getFormat(com.sce.adin.sam.client.util.DateUtil.serializeableDateTimeFormatString);
    String format = dateFormatter.format(date);
    return format;
    }
    });

    DateUtil.setShortDatetimeDisplayFormat(DateDisplayFormat.TOJAPANSHORTDATETIME);
    DateUtil.setDefaultDisplayTimezone("+00:00");
    DateUtil.setAdjustForDST(false);

    final DateTimeItem startDate = new DateTimeItem ("StartDate", "Start Date/Time in UTC");
    startDate.setRequired(false);
    startDate.setWidth(200);
    startDate.setUseTextField(true);
    startDate.setEnforceDate(true);

    // create form
    final DynamicForm form = new DynamicForm();
    form.setHeight100();
    form.setWidth100();
    form.setFields(startDate);

    VLayout vLayout = new VLayout();
    vLayout.setHeight100();
    vLayout.setWidth100();
    vLayout.setLayoutAlign(Alignment.RIGHT);
    vLayout.setMembers(form);

    vLayout.draw();

    }

    Please help and thank you!

    #2
    Both behaviors are by design. Provide a different defaultValue if you want a different behavior.

    Comment


      #3
      Yes, setting startDate.setDefaultValue(new Date()) will pre-populate with the right UTC date 2012/8/24 04:01 but clicking the Date chooser still has 23 highlighted and clicking Today day still shows 2012/8/23 00:00

      How do I set to make the Date chooser highlighted in 24 not 23 and clicking the Today day shows 2012/08/24 04:01

      Thanks again!

      Comment


        #4
        Ah - this does make sense - there was a mismatch between the date displayed in the chooser and the date displayed in the text field.
        We've addressed this in our code. The issue should be resolved in the next nightly build (dated Aug 25 or greater, 3.1d branch)

        Thanks
        Isomorphic Software

        Comment


          #5
          Thank you. I will try it out.

          Comment


            #6
            Hi Isomorphic,

            I tried out the 3.1d nightly build of Aug. 26 just now and the Date Chooser has the right UTC date 29 hightlighted however, when I clicked the "Today" button at the left bottom, it is not prepopulated with the UTC date (2012/8/29 00:00) but the browser's local date (2012/8/28 00:00).

            Is there a work around for the "Today" to show up in UTC time zone?

            Thank you for looking into this.

            Comment


              #7
              Sorry, but by "Today" we really think most users will mean today where they are physically located. There's no way to change the function of this button.

              Comment


                #8
                Makes sense. Then is there a way to capture what event the user has clicked on the Date Chooser so that when the user clicks the "Today" button, I can return a "new Date()" which will be in UTC time zone and display that on the form item ?

                Thanks

                Comment


                  #9
                  Is there a way to remove the Today field from the Date Chooser ?

                  Comment

                  Working...
                  X