{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/8656","repository_url":"https://api.github.com/repos/joomla/joomla-cms","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8656/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8656/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8656/events","html_url":"https://github.com/joomla/joomla-cms/pull/8656","id":121858973,"number":8656,"title":"Improve Datetime validation","user":{"login":"joomdonation","id":977664,"avatar_url":"https://avatars.githubusercontent.com/u/977664?v=3","gravatar_id":"","url":"https://api.github.com/users/joomdonation","html_url":"https://github.com/joomdonation","followers_url":"https://api.github.com/users/joomdonation/followers","following_url":"https://api.github.com/users/joomdonation/following{/other_user}","gists_url":"https://api.github.com/users/joomdonation/gists{/gist_id}","starred_url":"https://api.github.com/users/joomdonation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomdonation/subscriptions","organizations_url":"https://api.github.com/users/joomdonation/orgs","repos_url":"https://api.github.com/users/joomdonation/repos","events_url":"https://api.github.com/users/joomdonation/events{/privacy}","received_events_url":"https://api.github.com/users/joomdonation/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joomla/joomla-cms/labels/Language%20Change","name":"Language Change","color":"eb6420"},{"url":"https://api.github.com/repos/joomla/joomla-cms/labels/PR-staging","name":"PR-staging","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2015-12-12T14:18:32Z","updated_at":"2016-08-01T10:50:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/8656","html_url":"https://github.com/joomla/joomla-cms/pull/8656","diff_url":"https://github.com/joomla/joomla-cms/pull/8656.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/8656.patch"},"body":"## Problem\r\n\r\nCurrently, when you enter an invalid datetime value for a calendar form field, Joomla will throw a system error like this\r\n>\r\nDateTime::__construct() [datetime.--construct]: Failed to parse time string (jerror) ......\r\n\r\nThere were atleast two issues reported #8646 and #8093 which I can see\r\n\r\n## Solution\r\n\r\nI attempt to fix this issue by introducing a new form rule JFormRuleDatetime which uses strtotime($value) === false command to validate the value of the field. If it return false, the date is invalid and an exception will be returned\r\n\r\n## Testing instructions\r\n\r\nWith this PR, I just modify the add/edit article form in the backend of Joomla to show how it works.\r\n\r\nPlease try to edit an article, before this patch, if you enter a wrong value for any Calendar field (for example Start Publishing, Finish Publishing.., you will see a system error\r\n\r\nAfter this patch, there will be an error message like this being showed and it will prevent you from saving the article\r\n>\r\nWarning\r\nValue 2015-13-30 19:07:12 you entered for Start Publishing is invalid datetime format\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/236549298","html_url":"https://github.com/joomla/joomla-cms/pull/8656#issuecomment-236549298","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8656","id":236549298,"user":{"login":"wmchris","id":441389,"avatar_url":"https://avatars.githubusercontent.com/u/441389?v=3","gravatar_id":"","url":"https://api.github.com/users/wmchris","html_url":"https://github.com/wmchris","followers_url":"https://api.github.com/users/wmchris/followers","following_url":"https://api.github.com/users/wmchris/following{/other_user}","gists_url":"https://api.github.com/users/wmchris/gists{/gist_id}","starred_url":"https://api.github.com/users/wmchris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmchris/subscriptions","organizations_url":"https://api.github.com/users/wmchris/orgs","repos_url":"https://api.github.com/users/wmchris/repos","events_url":"https://api.github.com/users/wmchris/events{/privacy}","received_events_url":"https://api.github.com/users/wmchris/received_events","type":"User","site_admin":false},"created_at":"2016-08-01T10:50:09Z","updated_at":"2016-08-01T10:50:09Z","body":"I have tested this item :white_check_mark: successfully on 8c6b481d71d81c6f4beb889ad358be8db144b7b7<br /><br />Works as described @icampus\n\n  Value 201608-30 12:9:16 you entered for Start Publishing is invalid datetime format<hr /><sub>This comment was created with the <a href=\"https://github.com/joomla/jissues\">J!Tracker Application</a> at <a href=\"https://issues.joomla.org/tracker/joomla-cms/8656\">issues.joomla.org/joomla-cms/8656</a>.</sub>"}}
{"actor":{"display_login":"wmchris"}}