Details

    • Type: Sub-task
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6
    • Fix Version/s: 4.6
    • Component/s: CiviMail, Usability
    • Labels:
      None
    • Documentation Required?:
      None

      Description

      The current smarty-based implementation of date/time input widgets (common/jcalendar.tpl) is not reuseable outside of smarty. This task is to create a reusable date/time widget that wraps the jQuery plugins and can be used in multiple contexts (QuickForm, Angular, jQuery, etc).

        Attachments

        1. Date_validation_old_code.PNG
          156 kB
          David Greenberg
        2. Screen Shot 2015-03-09 at 6.26.31 PM.PNG
          58 kB
          David Greenberg
        3. TimeSetting_24hr_ignored.PNG
          40 kB
          David Greenberg

          Issue Links

            Activity

            [CRM-16019] Create clientSide date/time input widget
            David Greenberg added a comment -

            Coleman - let me know if / when you want me to do some testing on this.

            Coleman Watts added a comment -

            Updated PR - tests are now passing

            Coleman Watts added a comment -

            DGG - this is ready for user testing. The code has changed a lot but the end result should be pretty much the same for the user, except the datepicker will be localized.

            David Greenberg added a comment -

            Found 2 issues:
            1. Time format from date settings seems to be ignored. I changed to 24 hour time and still getting hh:mm AM/PM

            2. Date validation w/ old widget wasn’t great - but if you tried to submit mailing w/ invalid date - it threw form rule error and didn’t submit. With new widget - it submits and set’s Scheduled Date to now(). No error.
            Invalid examples:

            • 03/35/2015
            • Missing year element for the ’15 Mar 2015’ format ('15 Mar').

            Screenshots attached.

            Coleman Watts added a comment -

            I've pushed a fix for #1 to the PR.

            I've investigated #2 and it's a lot more complicated than I thought it would be. The behavior of the datepicker is to report invalid values as if the user had entered todays date. IMO this is an upstream bug. We have something called ui.datepicker.validation.pack installed and apparently running, but it isn't as helpful as I had hoped for this purpose. The docs for it are really terrible, but from what I gather it needs to be invoked in the context of validating the whole form, and the caller is responsible for knowing in advance all the validation rules to apply. This doesn't work for us atm, so I've slapped in a quick fix for now. Also pushed to the PR.

            David Greenberg added a comment -

            Time format is good.

            Date validation hack is working (invalid dates in red). However, I can still submit the mailing with an invalid date IF I've left the Time field blank (in this state the Submit Mailing button is active). As before, this action sets Schedule date and time to NOW().

            David Greenberg added a comment - - edited

            Hopefully we can prevent submit if Time is missing/invalid AND / OR date is missing/invalid. However I merged the existing PR to prevent it from going stale.

            Coleman Watts added a comment -

            Hey Dave, I tried to reproduce that and it seems that what actually happens when the user enters an invalid date and no time is that the radio gets reset to "Send Now".
            That kind of makes sense but is not the best UX so I've tweaked it a bit - this tweak had the side effect of clearing the invalid date but that's arguably not so bad and since we're talking about a narrow edge-case (who enters dates manually anyway?) is probably ok. At least everything else, including validation, seems to be working as expected now.
            https://github.com/civicrm/civicrm-core/pull/5355

              People

              • Assignee:
                David Greenberg
                Reporter:
                Coleman Watts

                Dates

                • Created:
                  Updated:
                  Resolved: