{"action":"opened","number":136,"pull_request":{"url":"https://api.github.com/repos/r-lib/scales/pulls/136","id":198124823,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4MTI0ODIz","html_url":"https://github.com/r-lib/scales/pull/136","diff_url":"https://github.com/r-lib/scales/pull/136.diff","patch_url":"https://github.com/r-lib/scales/pull/136.patch","issue_url":"https://api.github.com/repos/r-lib/scales/issues/136","number":136,"state":"open","locked":false,"title":"Add time_format() function for time formatting","user":{"login":"dpseidel","id":16724456,"node_id":"MDQ6VXNlcjE2NzI0NDU2","avatar_url":"https://avatars1.githubusercontent.com/u/16724456?v=4","gravatar_id":"","url":"https://api.github.com/users/dpseidel","html_url":"https://github.com/dpseidel","followers_url":"https://api.github.com/users/dpseidel/followers","following_url":"https://api.github.com/users/dpseidel/following{/other_user}","gists_url":"https://api.github.com/users/dpseidel/gists{/gist_id}","starred_url":"https://api.github.com/users/dpseidel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpseidel/subscriptions","organizations_url":"https://api.github.com/users/dpseidel/orgs","repos_url":"https://api.github.com/users/dpseidel/repos","events_url":"https://api.github.com/users/dpseidel/events{/privacy}","received_events_url":"https://api.github.com/users/dpseidel/received_events","type":"User","site_admin":false},"body":"This PR adds a new function, `time_format`, to format times properly, for both `POSIXt` and `hms` objects.  A separate function made more sense to me than did adjusting `date_format` to accommodate times, but if this code feels too redundant, I'm happy to implement changes to `date_format` instead.\r\n\r\nI also wonder if date_format and/or time_format shouldn't be moved to formatter.r with all the other formatters. \r\n\r\nAddresses #88\r\n\r\n-----------\r\nSome notes about handling timezones for hms objects: \r\n\r\nFor consistency, it seemed important to continue using standard POSIX specification for formatting, but while time zone of hms objects can be specified at conversion (from other datetime classes, defaults to local time) but they not have a tzone attribute themselves and can't/don't respect daylight savings (i.e. a day == 24 hours).  Coercing them back to POSIXct is easy but always sets the timezone to \"UTC\"  --  if our function allows the user to change this in higher level format function, times can quickly get misrepresented, especially around daylight savings time. On the other hand, if the user knows the original timezone of the hms object and set it properly during conversion, then being able to play with timezones is maybe a desirable feature.  \r\n\r\nUltimately I decided to go with the simplest approach and coerce hms objects to POSIXct and preserve the ability for the user to set the tz in the higher level format function but I'm curious what behavior you think is best. \r\n\r\nSome possible alternatives: \r\n- dropping the `tz` argument in line 143 OR dropping the tz argument entirely, replacing it with dots and feeding POSIXt objects directly into `date_format` which could take `tz`  when specified. It seemed a bit odd not to have a timezone argument in a formatting function for times though.\r\n- coercing to POSIXlt instead which ignores the tz argument in format. \r\n- adding a warning along the lines of _\"The timezone of all hms objects is assumed to be UTC.  Changing tz may result in incorrect times, please check your data carefully.\"_  if the user changes the tz argument and passes an hms object.\r\n\r\nAlso worth noting, while I hope anyone passing an `hms` object won't attempt to request a date-time format (especially from the explicitly named `time_format` function), as it stands, this fix doesn't do anything to prevent or warn users doing this.  If they do, the results will be incorrect (i.e. reporting from January 1970). \r\n\r\n","created_at":"2018-06-28T19:09:10Z","updated_at":"2018-06-28T19:09:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/r-lib/scales/pulls/136/commits","review_comments_url":"https://api.github.com/repos/r-lib/scales/pulls/136/comments","review_comment_url":"https://api.github.com/repos/r-lib/scales/pulls/comments{/number}","comments_url":"https://api.github.com/repos/r-lib/scales/issues/136/comments","statuses_url":"https://api.github.com/repos/r-lib/scales/statuses/9d047473829264e2f0a4517b2ca8a674ed798dd0","head":{"label":"dpseidel:hms_support","ref":"hms_support","sha":"9d047473829264e2f0a4517b2ca8a674ed798dd0","user":{"login":"dpseidel","id":16724456,"node_id":"MDQ6VXNlcjE2NzI0NDU2","avatar_url":"https://avatars1.githubusercontent.com/u/16724456?v=4","gravatar_id":"","url":"https://api.github.com/users/dpseidel","html_url":"https://github.com/dpseidel","followers_url":"https://api.github.com/users/dpseidel/followers","following_url":"https://api.github.com/users/dpseidel/following{/other_user}","gists_url":"https://api.github.com/users/dpseidel/gists{/gist_id}","starred_url":"https://api.github.com/users/dpseidel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpseidel/subscriptions","organizations_url":"https://api.github.com/users/dpseidel/orgs","repos_url":"https://api.github.com/users/dpseidel/repos","events_url":"https://api.github.com/users/dpseidel/events{/privacy}","received_events_url":"https://api.github.com/users/dpseidel/received_events","type":"User","site_admin":false},"repo":{"id":136050668,"node_id":"MDEwOlJlcG9zaXRvcnkxMzYwNTA2Njg=","name":"scales","full_name":"dpseidel/scales","owner":{"login":"dpseidel","id":16724456,"node_id":"MDQ6VXNlcjE2NzI0NDU2","avatar_url":"https://avatars1.githubusercontent.com/u/16724456?v=4","gravatar_id":"","url":"https://api.github.com/users/dpseidel","html_url":"https://github.com/dpseidel","followers_url":"https://api.github.com/users/dpseidel/followers","following_url":"https://api.github.com/users/dpseidel/following{/other_user}","gists_url":"https://api.github.com/users/dpseidel/gists{/gist_id}","starred_url":"https://api.github.com/users/dpseidel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpseidel/subscriptions","organizations_url":"https://api.github.com/users/dpseidel/orgs","repos_url":"https://api.github.com/users/dpseidel/repos","events_url":"https://api.github.com/users/dpseidel/events{/privacy}","received_events_url":"https://api.github.com/users/dpseidel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dpseidel/scales","description":"Graphical scales","fork":true,"url":"https://api.github.com/repos/dpseidel/scales","forks_url":"https://api.github.com/repos/dpseidel/scales/forks","keys_url":"https://api.github.com/repos/dpseidel/scales/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dpseidel/scales/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dpseidel/scales/teams","hooks_url":"https://api.github.com/repos/dpseidel/scales/hooks","issue_events_url":"https://api.github.com/repos/dpseidel/scales/issues/events{/number}","events_url":"https://api.github.com/repos/dpseidel/scales/events","assignees_url":"https://api.github.com/repos/dpseidel/scales/assignees{/user}","branches_url":"https://api.github.com/repos/dpseidel/scales/branches{/branch}","tags_url":"https://api.github.com/repos/dpseidel/scales/tags","blobs_url":"https://api.github.com/repos/dpseidel/scales/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dpseidel/scales/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dpseidel/scales/git/refs{/sha}","trees_url":"https://api.github.com/repos/dpseidel/scales/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dpseidel/scales/statuses/{sha}","languages_url":"https://api.github.com/repos/dpseidel/scales/languages","stargazers_url":"https://api.github.com/repos/dpseidel/scales/stargazers","contributors_url":"https://api.github.com/repos/dpseidel/scales/contributors","subscribers_url":"https://api.github.com/repos/dpseidel/scales/subscribers","subscription_url":"https://api.github.com/repos/dpseidel/scales/subscription","commits_url":"https://api.github.com/repos/dpseidel/scales/commits{/sha}","git_commits_url":"https://api.github.com/repos/dpseidel/scales/git/commits{/sha}","comments_url":"https://api.github.com/repos/dpseidel/scales/comments{/number}","issue_comment_url":"https://api.github.com/repos/dpseidel/scales/issues/comments{/number}","contents_url":"https://api.github.com/repos/dpseidel/scales/contents/{+path}","compare_url":"https://api.github.com/repos/dpseidel/scales/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dpseidel/scales/merges","archive_url":"https://api.github.com/repos/dpseidel/scales/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dpseidel/scales/downloads","issues_url":"https://api.github.com/repos/dpseidel/scales/issues{/number}","pulls_url":"https://api.github.com/repos/dpseidel/scales/pulls{/number}","milestones_url":"https://api.github.com/repos/dpseidel/scales/milestones{/number}","notifications_url":"https://api.github.com/repos/dpseidel/scales/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dpseidel/scales/labels{/name}","releases_url":"https://api.github.com/repos/dpseidel/scales/releases{/id}","deployments_url":"https://api.github.com/repos/dpseidel/scales/deployments","created_at":"2018-06-04T16:07:55Z","updated_at":"2018-06-27T16:56:05Z","pushed_at":"2018-06-28T16:30:04Z","git_url":"git://github.com/dpseidel/scales.git","ssh_url":"git@github.com:dpseidel/scales.git","clone_url":"https://github.com/dpseidel/scales.git","svn_url":"https://github.com/dpseidel/scales","homepage":"","size":584,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"r-lib:master","ref":"master","sha":"9e5e4d40181910aee1804b5205e846cb54d01cd0","user":{"login":"r-lib","id":22618716,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyNjE4NzE2","avatar_url":"https://avatars0.githubusercontent.com/u/22618716?v=4","gravatar_id":"","url":"https://api.github.com/users/r-lib","html_url":"https://github.com/r-lib","followers_url":"https://api.github.com/users/r-lib/followers","following_url":"https://api.github.com/users/r-lib/following{/other_user}","gists_url":"https://api.github.com/users/r-lib/gists{/gist_id}","starred_url":"https://api.github.com/users/r-lib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r-lib/subscriptions","organizations_url":"https://api.github.com/users/r-lib/orgs","repos_url":"https://api.github.com/users/r-lib/repos","events_url":"https://api.github.com/users/r-lib/events{/privacy}","received_events_url":"https://api.github.com/users/r-lib/received_events","type":"Organization","site_admin":false},"repo":{"id":1060514,"node_id":"MDEwOlJlcG9zaXRvcnkxMDYwNTE0","name":"scales","full_name":"r-lib/scales","owner":{"login":"r-lib","id":22618716,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyNjE4NzE2","avatar_url":"https://avatars0.githubusercontent.com/u/22618716?v=4","gravatar_id":"","url":"https://api.github.com/users/r-lib","html_url":"https://github.com/r-lib","followers_url":"https://api.github.com/users/r-lib/followers","following_url":"https://api.github.com/users/r-lib/following{/other_user}","gists_url":"https://api.github.com/users/r-lib/gists{/gist_id}","starred_url":"https://api.github.com/users/r-lib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r-lib/subscriptions","organizations_url":"https://api.github.com/users/r-lib/orgs","repos_url":"https://api.github.com/users/r-lib/repos","events_url":"https://api.github.com/users/r-lib/events{/privacy}","received_events_url":"https://api.github.com/users/r-lib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/r-lib/scales","description":"Graphical scales","fork":false,"url":"https://api.github.com/repos/r-lib/scales","forks_url":"https://api.github.com/repos/r-lib/scales/forks","keys_url":"https://api.github.com/repos/r-lib/scales/keys{/key_id}","collaborators_url":"https://api.github.com/repos/r-lib/scales/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/r-lib/scales/teams","hooks_url":"https://api.github.com/repos/r-lib/scales/hooks","issue_events_url":"https://api.github.com/repos/r-lib/scales/issues/events{/number}","events_url":"https://api.github.com/repos/r-lib/scales/events","assignees_url":"https://api.github.com/repos/r-lib/scales/assignees{/user}","branches_url":"https://api.github.com/repos/r-lib/scales/branches{/branch}","tags_url":"https://api.github.com/repos/r-lib/scales/tags","blobs_url":"https://api.github.com/repos/r-lib/scales/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/r-lib/scales/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/r-lib/scales/git/refs{/sha}","trees_url":"https://api.github.com/repos/r-lib/scales/git/trees{/sha}","statuses_url":"https://api.github.com/repos/r-lib/scales/statuses/{sha}","languages_url":"https://api.github.com/repos/r-lib/scales/languages","stargazers_url":"https://api.github.com/repos/r-lib/scales/stargazers","contributors_url":"https://api.github.com/repos/r-lib/scales/contributors","subscribers_url":"https://api.github.com/repos/r-lib/scales/subscribers","subscription_url":"https://api.github.com/repos/r-lib/scales/subscription","commits_url":"https://api.github.com/repos/r-lib/scales/commits{/sha}","git_commits_url":"https://api.github.com/repos/r-lib/scales/git/commits{/sha}","comments_url":"https://api.github.com/repos/r-lib/scales/comments{/number}","issue_comment_url":"https://api.github.com/repos/r-lib/scales/issues/comments{/number}","contents_url":"https://api.github.com/repos/r-lib/scales/contents/{+path}","compare_url":"https://api.github.com/repos/r-lib/scales/compare/{base}...{head}","merges_url":"https://api.github.com/repos/r-lib/scales/merges","archive_url":"https://api.github.com/repos/r-lib/scales/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/r-lib/scales/downloads","issues_url":"https://api.github.com/repos/r-lib/scales/issues{/number}","pulls_url":"https://api.github.com/repos/r-lib/scales/pulls{/number}","milestones_url":"https://api.github.com/repos/r-lib/scales/milestones{/number}","notifications_url":"https://api.github.com/repos/r-lib/scales/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/r-lib/scales/labels{/name}","releases_url":"https://api.github.com/repos/r-lib/scales/releases{/id}","deployments_url":"https://api.github.com/repos/r-lib/scales/deployments","created_at":"2010-11-08T00:44:23Z","updated_at":"2018-06-22T15:43:16Z","pushed_at":"2018-06-27T19:56:46Z","git_url":"git://github.com/r-lib/scales.git","ssh_url":"git@github.com:r-lib/scales.git","clone_url":"https://github.com/r-lib/scales.git","svn_url":"https://github.com/r-lib/scales","homepage":"","size":588,"stargazers_count":116,"watchers_count":116,"language":"R","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":47,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":47,"open_issues":19,"watchers":116,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/r-lib/scales/pulls/136"},"html":{"href":"https://github.com/r-lib/scales/pull/136"},"issue":{"href":"https://api.github.com/repos/r-lib/scales/issues/136"},"comments":{"href":"https://api.github.com/repos/r-lib/scales/issues/136/comments"},"review_comments":{"href":"https://api.github.com/repos/r-lib/scales/pulls/136/comments"},"review_comment":{"href":"https://api.github.com/repos/r-lib/scales/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/r-lib/scales/pulls/136/commits"},"statuses":{"href":"https://api.github.com/repos/r-lib/scales/statuses/9d047473829264e2f0a4517b2ca8a674ed798dd0"}},"author_association":"COLLABORATOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":32,"deletions":1,"changed_files":3}}
{"actor":{"display_login":"dpseidel"}}