Announcement

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

    "period" is displayed in the date formate instead of slash.

    Hi,
    We are using Smart Gwt-4.1p (29th Oct 2014)
    Browser: Google chrome 39.0.2171.95 m, IE8 and IE9

    Our application is supporting multi languages.

    We are using "DateChooser" control to select the date, User selected date will be displayed in MM/DD/YYYY and DD/MM/YYYY format. But in the case of "German" language period is displayed (DD.MM.YYYY). I want to display slash in all the languages.

    Please share the information how to fix this issue.

    Please find the sample code which i wrote:

    public DateDisplayFormat getDateDisplayFormat(dateAndTimeFormat) {

    if ("MM/dd/yyyy".equals(pattern)) {
    return DateDisplayFormat.TOUSSHORTDATE;

    } else if ("yyyy/MM/dd".equals(pattern)) {
    return DateDisplayFormat.TOJAPANSHORTDATE;

    } else if ("dd/MM/yyyy".equals(pattern)) {
    return DateDisplayFormat.TOEUROPEANSHORTDATE;
    }
    }


    DateItem dateField = dateField.setDateFormatter(getDateDisplayFormat());


    Regards,
    Attached Files
    Last edited by vnathank; 2 Jan 2015, 02:41.

    #2
    Period is the correct default for Germany, at least, it's what GWT itself also defaults to.

    If you really want to override this, see the docs for DateUtil.

    Comment


      #3
      Hi,

      I did not find any approach to override the "DateDisplayFormat" in the "dateUtil" document.

      Could you please let me know which API's\ Functions i should use to override to achieve this.

      Following method i override but still issue not resolved.

      --------------------------------------------
      final DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd/MM/yyyy");
      DateInputFormatter dateInputFormatter = new DateInputFormatter() {
      public Date parse(String s) {
      if (s == null)
      return null;
      return dateFormatter.parse(s);
      }
      };
      ------------------------------------------------------


      Regards,

      Comment


        #4
        Best guess is that you did not find the DateUtil docs at all, since you're not even trying to call any APIs on it yet.

        The APIs you need to call to influence default date formatting have obvious names like setNormalDateDisplayFormatter and actually have sample code right in the docs, so it's very difficult not to succeed.

        But again a reminder - what you probably want to do is nothing at all, since the separators are already correct.

        Comment


          #5
          Hi,

          Thank you for your response,

          >>>>>Isomorphic : But again a reminder - what you probably want to do is nothing at all, since the separators are already correct. <<<<

          Actually the date display format in German language(DD.MM.YYYY) is different to other languages(DD/MM/YYYY).
          So i want to display slash in the date format for German language also. For this reason i wanted to override this format.

          Please let us know whether we can achieve this by overriding or not.

          Regards,
          Last edited by vnathank; 21 Jan 2015, 01:22.

          Comment


            #6
            Yes, we understood that this is what you wanted to do. As we explained, we would advise you not to do it, because the default separator for dates used in the German locale is a dot, not a slash.

            That's why GWT does this, and by overriding this you are actually making your application less usable for Germans.

            But if you insist upon doing this, we have already explained (multiple times) how to do this.
            Last edited by Isomorphic; 21 Jan 2015, 02:04. Reason: Corrected typo

            Comment


              #7
              Hi vnathank,

              as party concerned I can tell you that I would definitely not prefer "DD/MM/YYYY" over "DD.MM.YYYY". Only "MM/DD/YYYY" would be more worse. In Germany, we use "DD.MM.YYYY" in all normal cases (letter, documents, etc.) and in IT related areas (e.g. filenames) sometimes "YYYY-MM-DD" in order to have a chronological sorting if sorted alphabetically.

              Best regards,
              Blama

              Comment


                #8
                Hello,

                The above issue is working fine with DateUtil.

                We have same type of issue for file size.
                We are using NumberFormat nfx = NumberFormat.getFormat("#,##0.000") to display file size.

                In English : File size is displaying as 2,212.676 MB -Correct
                In Dutch, German -File size is displaying as 2.212,676 MB -Incorrect
                In German,Dutch.. comma is displaying as dot and dot is displaying as comma.

                Is there any way to override default properties for filesize like DateUtil.

                Thanks.

                Comment


                  #9
                  Issue in NumberFormat localization

                  The above issue is working with java.text.NumberFormat.
                  But in Gwt not able to compile java.text.

                  Please update me if any alternate solution is available in GWT or Smart Gwt.

                  Thanks.

                  Comment


                    #10
                    Hi vnathank,

                    see this hack here at SO regarding your separator-question.

                    Best regards,
                    Blama

                    Comment


                      #11
                      Thank you Blama.
                      It is working fine .

                      Comment

                      Working...
                      X