Tapestry 5
  1. Tapestry 5
  2. TAP5-1409

datefield - cannot select same day in different month

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.4
    • Fix Version/s: 5.3
    • Component/s: None
    • Labels:
      None

      Description

      say your date format is m/d/yyyy and the initial value is 1/1/2011 and you want to change it to 2/1/2011.. that is not possible. changing month, the selected 'day' is still selected and therefore not selectable.

      use case:

      initial date is 1/1/2011
      1. open date picker
      2. change month to feb
      3. try to click on 1st of feb

      • nothing happens.
      1. datepicker.js
        23 kB
        Antal van Kalleveen

        Issue Links

          Activity

          Hide
          Paul Stanton added a comment -

          a workaround/patch is to remove the lines 345-348 in datepicker.js:

          if (this._selectedDate.getDate() != oDate.getDate() ||
          this._selectedDate.getMonth() != oDate.getMonth() ||
          this._selectedDate.getFullYear() != oDate.getFullYear() ||
          this._none)

          however this does not solve the fact that the date is highlighted on all months, ie if you start with 1/1, then 2/1 and 3/1 and 4/1 etc will also be highlighted (css class "selected).

          this patch also partially resolves TAP5-1408 as you can now close the popup by selecting the current date.

          Show
          Paul Stanton added a comment - a workaround/patch is to remove the lines 345-348 in datepicker.js: if (this._selectedDate.getDate() != oDate.getDate() || this._selectedDate.getMonth() != oDate.getMonth() || this._selectedDate.getFullYear() != oDate.getFullYear() || this._none) however this does not solve the fact that the date is highlighted on all months, ie if you start with 1/1, then 2/1 and 3/1 and 4/1 etc will also be highlighted (css class "selected). this patch also partially resolves TAP5-1408 as you can now close the popup by selecting the current date.
          Hide
          Antal van Kalleveen added a comment -

          Attached 'datepicker.js' is a modified version which contains fixes for TAP-1408 and TAP-1409

          Show
          Antal van Kalleveen added a comment - Attached 'datepicker.js' is a modified version which contains fixes for TAP-1408 and TAP-1409
          Hide
          Paul Stanton added a comment -

          thanks for working on the patch antal,

          the only remaining minor issue is that the selected date in other months is still highlighted.

          your patch is good, cheers, p.

          Show
          Paul Stanton added a comment - thanks for working on the patch antal, the only remaining minor issue is that the selected date in other months is still highlighted. your patch is good, cheers, p.
          Hide
          Robert Zeigler added a comment -

          But no test cases on the patch.

          I'll be taking a slightly different tact for this problem, one that should also resolve the issue that the selected day-of-month is highlighted in other months, even if that day isn't selected.

          Show
          Robert Zeigler added a comment - But no test cases on the patch. I'll be taking a slightly different tact for this problem, one that should also resolve the issue that the selected day-of-month is highlighted in other months, even if that day isn't selected.
          Hide
          Robert Zeigler added a comment -

          Datepicker now separates the concepts of the "calendar date" (the currently active month in the calendar" from the "selected date" (the date chosen by the user). It simplified a lot of the code and resolves this issue; also improved the "today" handling a bit.

          Show
          Robert Zeigler added a comment - Datepicker now separates the concepts of the "calendar date" (the currently active month in the calendar" from the "selected date" (the date chosen by the user). It simplified a lot of the code and resolves this issue; also improved the "today" handling a bit.
          Hide
          Hudson added a comment -

          Integrated in tapestry-trunk-freestyle #440 (See https://builds.apache.org/job/tapestry-trunk-freestyle/440/)
          TAP5-1408: datefield - cannot select same day in different month
          TAP5-1409: datefield popup does not have option to cancel

          robertdzeigler : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1151673
          Files :

          • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DateFieldDemo.java
          • /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/datepicker_106/js/datepicker.js
          • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
          Show
          Hudson added a comment - Integrated in tapestry-trunk-freestyle #440 (See https://builds.apache.org/job/tapestry-trunk-freestyle/440/ ) TAP5-1408 : datefield - cannot select same day in different month TAP5-1409 : datefield popup does not have option to cancel robertdzeigler : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1151673 Files : /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DateFieldDemo.java /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/datepicker_106/js/datepicker.js /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
          Hide
          b kopelove added a comment -

          This fix is great but it introduced a different bug. When one clicks on the month name at the top of the calendar, a popup list of surrounding months is shown. Upon clicking one of these months, the calendar disappears because the javascript thinks that you have clicked "outside" the calendar and exits.

          I identified a simple fix to not exit when a popup month is selected:

          ---change:
          331 if (parent.className == 'datePicker') {

          ---to:
          331 if (parent.className == 'datePicker' || parent.className == 'labelPopup') {

          Show
          b kopelove added a comment - This fix is great but it introduced a different bug. When one clicks on the month name at the top of the calendar, a popup list of surrounding months is shown. Upon clicking one of these months, the calendar disappears because the javascript thinks that you have clicked "outside" the calendar and exits. I identified a simple fix to not exit when a popup month is selected: ---change: 331 if (parent.className == 'datePicker') { ---to: 331 if (parent.className == 'datePicker' || parent.className == 'labelPopup') {
          Hide
          Robert Zeigler added a comment -

          Re-opened to address month popup issue.

          Show
          Robert Zeigler added a comment - Re-opened to address month popup issue.
          Hide
          Robert Zeigler added a comment -

          The bug with the datepicker closing when selecting a month from the drop down is still present; the test for it was checking the visibility too quickly, so the picker was still visible for the test, but would not be visible a few milliseconds later.

          Show
          Robert Zeigler added a comment - The bug with the datepicker closing when selecting a month from the drop down is still present; the test for it was checking the visibility too quickly, so the picker was still visible for the test, but would not be visible a few milliseconds later.

            People

            • Assignee:
              Robert Zeigler
              Reporter:
              Paul Stanton
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development