User tests: Successful: Unsuccessful:
The birth date is always the same, around the world, independend from any timezone.
Also the combination of date-only + timezone converting filter will make the user one day older each time (s)he clicks Edit.
To solve I changed filter to prevent conversion.
Test:
(on com_finder Start Date / End Date you have the same effect but on eastern timezone, e.g. Berlin - but that's another story)
Labels |
Added:
?
|
Then there is a valid filter for date only missing.
If you have a date without time any timezone handling is useless and impossible.
In some cases the time could be intended as 00:00 if not given - but in case of birthday there is no absolute time which would result in different values depending on the timezone.
I don't know where the problems really comes from. I only see the results in e.g. profile plugin or com_filter (which is a little bit different because there users would expect date with implied 00:00 user`s local time).
But regardless which solution fixes the problem. It would be good to find one.
There is no issue as long as the timezone is again added when reading/displaying the date.
Example:
Date entered is 2015-02-14 (00:00)
Date saved is 2015-02-13 23:00 due to 1hr TZ difference
Now our profile plugin shows the date as stored in the db, which is wrong.
Instead it should apply the timezone again and format it to date only using
JHtml::date()
(https://api.joomla.org/cms-3/classes/JHtml.html#method_date). Then it would correctly show as 2015-02-14.
So I think the real issue is in the display part, not in how it is stored. The storing part looks actually correct.
For reference: https://github.com/joomla/joomla-cms/blob/staging/components/com_users/views/profile/tmpl/default_custom.php#L45 is where the value is displayed
If we want to use a proper JHtml::date() call there, we would need to somehow register a JHtml::_('users.dob', $value)
, which then would properly display the date.
The existing are here https://github.com/joomla/joomla-cms/blob/staging/components/com_users/helpers/html/users.php however I guess it should be possible to register one from the profile plugin. Haven't ever played with that though.
Category | ⇒ | Plugins |
Think also that there is something wrong in conversion itself so my idea was more a workaround.
Unfortunately I haven't enough time and experience to make a real solution. So it would be great if someone else could do this please.
Thank you for creating this. It’s been some time since you created this and there are now some merge conflicts that prevent a direct merge. As no one else has shown any interest in providing the code and you have not then I am closing this issue at this time. If code is provided (a pull request) it can always be re-examined.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-05-08 17:00:41 |
Closed_By | ⇒ | Kubik-Rubik |
While I can reproduce the issue (not with "New York", but with "Zurich"), I disagree with the solution.
string
is not a valid filter for a calendar formfield. Obviously it should only accept a valid date, and not a string.The formfield supports two filters:
SERVER_UTC
andUSER_UTC
. Both will create the same issue since Joomla will store the date as UTC in the database and thus applies the timezone difference when storing.It also is related to the fact that we only want to store a Date, but Joomla will store it as DateTime.
On a sidenote, the profile also shows the time, when it should only show the date.
Personally I think the real bug is somewhere in the way the profile plugin handles the date of birth field. There is quite a bit of extra handling present.
Most likely, it should show the date using a proper JHtml::date() call, where the timezone would be added again and where you also pass a format parameter. From glancing over it, that seems to be missing.