Click
  1. Click
  2. CLK-316

DateField and non-changed Dates

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5 M3
    • Fix Version/s: 1.5 RC1
    • Component/s: extras
    • Labels:
      None

      Description

      Having a DateField in a CayenneForm can be problematic. As the Date is converted to String and back to a Date, it will be modified from the java perspective even though the user did not change it.

      This is extra frustrating for read only DateFields showing a read only date column from the database since click will change the Date-value in the cayenne DataObject to a parsed Date that is different from the original Date.

        Activity

        Show
        Tore Halset added a comment - This issue was raised on the mail list. http://sourceforge.net/mailarchive/forum.php?thread_name=F54AA5E9-2935-46A4-81E4-EA9FF33F42BD%40pvv.ntnu.no&forum_name=click-user
        Hide
        Bob Schellink added a comment -

        So the dateField should cache the parsed value and return it on subsequent calls.

        There are a couple of other controls in click-extras with the same behavior as DateField: IntegerField, DoubleField, LongField etc.

        If we change DateField its probably good to change the others too.

        Show
        Bob Schellink added a comment - So the dateField should cache the parsed value and return it on subsequent calls. There are a couple of other controls in click-extras with the same behavior as DateField: IntegerField, DoubleField, LongField etc. If we change DateField its probably good to change the others too.
        Hide
        Malcolm Edgar added a comment -

        I am not sure I am following what the problem is here. Is the Date -> String -> Date conversion yielding a different date result? Is the time components being stripped, etc.

        regards Malcolm Edgar

        Show
        Malcolm Edgar added a comment - I am not sure I am following what the problem is here. Is the Date -> String -> Date conversion yielding a different date result? Is the time components being stripped, etc. regards Malcolm Edgar
        Hide
        Tore Halset added a comment -

        Bob: not only cache the parsed value, but not need to parse when the String representation has not changed.

        Malcolm: Starting with a new Date() with milliseconds and what ever. Sending that to a DateField with a format pattern that only show date and time reduce the precision of the value. Convert it back to a Date and those two Date-objects are not equal.

        Perhaps this is what you want, but it was a bit strange that even the read*only DateField changed.

        Show
        Tore Halset added a comment - Bob: not only cache the parsed value, but not need to parse when the String representation has not changed. Malcolm: Starting with a new Date() with milliseconds and what ever. Sending that to a DateField with a format pattern that only show date and time reduce the precision of the value. Convert it back to a Date and those two Date-objects are not equal. Perhaps this is what you want, but it was a bit strange that even the read*only DateField changed.
        Hide
        Bob Schellink added a comment -

        Think we need to resolve this one.

        Show
        Bob Schellink added a comment - Think we need to resolve this one.
        Hide
        Bob Schellink added a comment -

        Fix checked in. DateField#setValue(String) will parse and cache the value into a Date variable. This cached Date will be returned when retrieving the date.

        Show
        Bob Schellink added a comment - Fix checked in. DateField#setValue(String) will parse and cache the value into a Date variable. This cached Date will be returned when retrieving the date.

          People

          • Assignee:
            Malcolm Edgar
            Reporter:
            Tore Halset
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development