User tests: Successful: Unsuccessful:
Pull Request for Issue #17171 .
Removed a conditional that prevented dates to be updated manually (via input field) after the date is changed via the calendar tool.
DATE 2 should be saved
DATE 1 is saved
Might need @farhadst to test the Jallali calendar
(this is my first attempt to contribute code changes so please let me know if I'm doing it incorrectly)
Status | New | ⇒ | Pending |
Category | ⇒ | JavaScript |
@infograf768 @drewgg you are removing a check if (typeof calObj.dateClicked === 'undefined') {
IIRC I put that so we can distinguish the 2 different inputs (typed or GUI). have you checked if this
if (typeof calObj.params.dateClicked === 'undefined') {
works? (it seems wrong that this param is mot under the params object...
@dgt41 That conditional works as expected before the first time the date/time is changed via the tool but once the tool is used to affect the date/time then calObj.dateClicked
will be either true
or false
but never again undefined
(until the page is reloaded).
When I modified to to also check for truthiness as well (if (typeof calObj.dateClicked === 'undefined' || calObj.dateClicked === false) {
) it corrected the issue in most cases. However, it would still break when clicking the "today" button (which sets calObj.dateClicked
to true
when clicked). It looked like the issue only happened when the conditional returned false (when calObj.dateClicked
is true
).
More precisely, the issue happens when data-local-value
isn't being set. The truthy path set's both data-local-value
and data-alt-value
. The falsey path only sets data-alt-value
. That seems to be the core issue. My original patch was to set the data-local-value
in the falsey path:
} else {
calObj.inputField.setAttribute('data-local-value', Date.parseFieldDate(calObj.inputField.value, calObj.params.dateFormat, calObj.params.dateType)
.print(calObj.params.dateFormat, 'gregorian', false));
calObj.inputField.setAttribute('data-alt-value', Date.parseFieldDate(calObj.inputField.value, calObj.params.dateFormat, calObj.params.dateType)
.print(calObj.params.dateFormat, 'gregorian', false));
}
This seems to fix the issue, but at that point I couldn't see the benefit of the falsey path vs the truthy one. Both are nearly equivalent in what they are doing (setting data-local-value
and data-alt-value
) other than the truthy path seems to have better data/formatting checks. That's what led me to just remove the conditional and falsey path.
edit Oh, my apologies. I just realized in your question about whether I had tested that conditional you had changed it from calObj.dateClicked
to calObj.params.dateClicked
. No, I had not tested that. Let me do that now.
Do I need to do anything do fix that "continuous-integration/drone/pr" build failure?
@drewgg don't worry the fail is not related to the code here. But you need to update the minified file as well as @brianteeman mentioned above
Test with Gregorian calendar works fine.
@drewgg @infograf768
I replace the calendar.js and calendar.min.js
This work for persian calendar:
Open an article (new or existing)
Change the "Start Publishing" date/time via the calendar tool
Change the "Start Publishing" date/time manually (via typing in the text field)
Save the article
Date saved is via manually
but problem for persian calendar in set manually date (in some months, one day will be added or one day will be reduced) not fix
@drewgg
Please add this modified code proposed by @dgt41 #17150 (comment)
and update also the minified version.
This would solve both Jalali calendar and this popup followed by field edit.
@infograf768 Considering #17150 (comment), do you still want me to apply those edits? Or hold off until there is resolution?
Let's wait a bit indeed.
I have tested this item
I have tested this item
I guess we should separate this issue from the Jalali calendar issue and set this as RTC
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-07-31 11:44:12 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
|
You can use any minify tool. There is no preference for j3