{"action":"opened","issue":{"url":"https://api.github.com/repos/thoughtbot/administrate/issues/716","repository_url":"https://api.github.com/repos/thoughtbot/administrate","labels_url":"https://api.github.com/repos/thoughtbot/administrate/issues/716/labels{/name}","comments_url":"https://api.github.com/repos/thoughtbot/administrate/issues/716/comments","events_url":"https://api.github.com/repos/thoughtbot/administrate/issues/716/events","html_url":"https://github.com/thoughtbot/administrate/issues/716","id":196316411,"number":716,"title":"Format for datetimepickers should be customizable","user":{"login":"mcmire","id":7371,"avatar_url":"https://avatars.githubusercontent.com/u/7371?v=3","gravatar_id":"","url":"https://api.github.com/users/mcmire","html_url":"https://github.com/mcmire","followers_url":"https://api.github.com/users/mcmire/followers","following_url":"https://api.github.com/users/mcmire/following{/other_user}","gists_url":"https://api.github.com/users/mcmire/gists{/gist_id}","starred_url":"https://api.github.com/users/mcmire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcmire/subscriptions","organizations_url":"https://api.github.com/users/mcmire/orgs","repos_url":"https://api.github.com/users/mcmire/repos","events_url":"https://api.github.com/users/mcmire/events{/privacy}","received_events_url":"https://api.github.com/users/mcmire/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-19T02:00:46Z","updated_at":"2016-12-19T02:00:46Z","closed_at":null,"body":"Right now the format for all datetimepickers is hardcoded to include time elements:\r\n\r\n``` javascript\r\n$(function () {\r\n  $(\".datetimepicker\").datetimepicker({\r\n    debug: false,\r\n    format: \"YYYY-MM-DD HH:mm:ss\",\r\n  });\r\n});\r\n```\r\n\r\nHowever, if you want to create a date field, then having a format that includes time elements doesn't make any sense.\r\n\r\nHere is what I have in my app:\r\n\r\n``` javascript\r\n(function () {\r\n  $(\"[data-datetimepicker]\").each(function (i, el) {\r\n    var field = $(el);\r\n    var format = field.data(\"format\") || \"YYYY-MM-DD HH:mm:ss\";\r\n\r\n    field.datetimepicker({\r\n      debug: false,\r\n      format: field.data(\"format\"),\r\n    });\r\n  });\r\n})();\r\n```\r\n\r\nThis would, of course, necessitate changing the views to use `data` attributes instead of a class."}}
{"actor":{"display_login":"mcmire"}}