Announcement

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

    Something adds 2 hours to DateTime

    Hi,
    clicking between the date- and textfield adds 2 hours to the time.

    Seems only the case when using format DateDisplayFormat.TOSERIALIZEABLEDATE.

    SmartGWT build 715

    Code:
    private Canvas getTest3() {
    		Canvas c = new Canvas();
    		
    		final DynamicForm form = new DynamicForm();
    		
    		final DateItem date = new DateItem("Date");
    		date.setDateFormatter(DateDisplayFormat.TOSERIALIZEABLEDATE);
    		date.setUseTextField(true);
    		
    		TextItem text = new TextItem("Text");
    		
    		form.setItems(date, text);
    		
    		c.addChild(form);
    		
    		final Label label = new Label();
    		label.moveTo(0, 100);
    		
    		date.addChangedHandler(new ChangedHandler() {
    			
    			public void onChanged(ChangedEvent event) {
    				label.setContents(date.getValue().toString());
    			}
    		});
    		
    		
    		
    		c.addChild(label);
    		
    		return c;
    	}

    #2
    That formatter uses local time (local to browser). What were you expecting?

    Comment


      #3
      No no, bug is that if you click the date field a few times - e.g. switch focus from the textfield to the datefield - the date adds 2 hours to itself each click. I thought it maybe were the current seconds, but no, if you do it a few times, the day changes too.

      Comment


        #4
        This is just a case of mismatched display format and input format, which can have many unpredictable results. Make sure these match or you'll get this kind of problem.

        Comment

        Working...
        X