Click
  1. Click
  2. CLK-251

Urgent : Error on control format on DateField

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: extras
    • Labels:
      None
    • Environment:
      Apache / Tomcat / mySQL / Click 1.4RC1 or Click 1.3.1

      Description

      The format control on DateField doesn't work on the year and triggers bad format date in the database

      First case :
      The date format pattern is : dd-MM-yyyy
      When you input 02-07-200x, Click accept this date and put in the database the 02-07-0200 value

      Second case :
      same date format pattern
      When tou input 02-07-0007, Click accept this date and put in the DB the 02-07-0007 value

      To avoid the second case, I've changed the date format pattern in dd-MM-20yy and the first case doesn't appears ! Why ?
      But I have a problem on birth date which begins with 19xx or 20xx, i can't put two date format dd-MM-20yy and dd-MM-19yy

      Could you please correct this issue and tell me what i have to do for birth date ?
      Thank you in advance

        Activity

        Hide
        Malcolm Edgar added a comment -

        Unfortunately Java date parsing was designed in the 1990's is not a good fit now for our 2000 plus world. However, we will not modify the DateField to diverge from the normal Java date parsing.

        Show
        Malcolm Edgar added a comment - Unfortunately Java date parsing was designed in the 1990's is not a good fit now for our 2000 plus world. However, we will not modify the DateField to diverge from the normal Java date parsing.
        Hide
        Bob Schellink added a comment -

        Hi

        Click uses Java's SimpleDateFormat to format and parse dates. You can test this yourself by creating your own SimpleDateFormat object and parsing the date '02-07-200x'.

        You can always create your own DateField and override the validate() method to provide custom formatting and parsing.

        Another option is to use joda time to format the dates -> http://joda-time.sourceforge.net/

        Show
        Bob Schellink added a comment - Hi Click uses Java's SimpleDateFormat to format and parse dates. You can test this yourself by creating your own SimpleDateFormat object and parsing the date '02-07-200x'. You can always create your own DateField and override the validate() method to provide custom formatting and parsing. Another option is to use joda time to format the dates -> http://joda-time.sourceforge.net/
        Hide
        Christophe FOIRET added a comment -

        Please, could you reply to my issue ?
        Thank you in advance

        Show
        Christophe FOIRET added a comment - Please, could you reply to my issue ? Thank you in advance

          People

          • Assignee:
            Malcolm Edgar
            Reporter:
            Christophe FOIRET
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development