Announcement

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

    Problem displaying date in DateItem

    Hi,

    I am using SmartGWT 3.1, GWT 2.5 and Mozilla FF 20.xx browser, Google Chrome 24.x and IE 8

    I have a java.util.Date object which represents 1st January 0001

    My DateItem has default date display format (MM/dd/yyyy)

    Whenever I am trying to set the above date value to my DateItem, it shows 01/01/1 on the UI and after clicking on date picker icon, 1st January 1901 gets selected by default. After closing the date picker, in my date item it shows 01/01/1901

    My requirement is that it should show 01/01/0001

    Can you please let me know what should I do to achieve this ?

    Please note that if my date is 1st January 1975, then DateItem shows it correctly.
    Last edited by pratik.thaker; 17 Apr 2013, 00:53. Reason: added extra problem description

    #2
    Please see test case for this,

    Code:
    public void onModuleLoad() {
    		DynamicForm dynamicForm = new DynamicForm();
    		
    		DateItem dateItem = new DateItem("test", "Date");
    		
    		Date date = new Date(-1899,0,1);
    		
    		dateItem.setValue(date);
    		
    		dateItem.setUseTextField(true);
    		
    		dynamicForm.setFields(dateItem);
    		
    		dynamicForm.draw();
    	}
    I have also attached screenshot of the created date item.
    Attached Files

    Comment


      #3
      We've fixed this in 3.1p and 4.0d - please retest with a nightly build dated April 28 or later

      Comment


        #4
        date format has prefix zeroes when TOUSSHORTDATE formatter is used

        We are using smartGWT 4.1p (Nov9, 2014 patch), GWT 2.4 and testing our application with Firefox 24.0, IE 8 / 9 browsers

        We use a DateItem for Date selection and display which has the following formatting in the initialization section:

        Code:
        setUseTextField(true)
        setDateFormatter(TOUSSHOTDATE);
        Earlier when we were using smartGWT 2.2 and GWT 2.0.3 the date was display in the expected format as below :

        For Ex : 1st Jan 2014 --> 1/1/2014

        But after smartGWT upgrade to 4.1 we see the same date displayed in the following format: 01/01/2014

        The Prefix zero shows up even when the dateformatter is setup. We have even tried the setDisplayFormat() but that didnt help too.

        Please help me understand why its behaving in such a way. Is it the expected behavior in smartGWT 4.1? Please help me reach a solution for the same

        Comment

        Working...
        X