{"action":"created","comment":{"url":"https://api.github.com/repos/apache-superset/superset-ui/pulls/comments/237620603","pull_request_review_id":179965549,"id":237620603,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNzYyMDYwMw==","diff_hunk":"@@ -0,0 +1,23 @@\n+## @superset-ui/time-format\n+\n+[![Version](https://img.shields.io/npm/v/@superset-ui/time-format.svg?style=flat)](https://img.shields.io/npm/v/@superset-ui/time-format.svg?style=flat)\n+[![David (path)](https://img.shields.io/david/apache-superset/superset-ui.svg?path=packages%2Fsuperset-ui-time-format&style=flat-square)](https://david-dm.org/apache-superset/superset-ui?path=packages/superset-ui-time-format)\n+\n+Description\n+\n+#### Example usage","path":"packages/superset-ui-time-format/README.md","position":8,"original_position":8,"commit_id":"ab70b9b8bf390ce1d047264ef292679a5a5f611b","original_commit_id":"ab70b9b8bf390ce1d047264ef292679a5a5f611b","user":{"login":"kristw","id":1659771,"node_id":"MDQ6VXNlcjE2NTk3NzE=","avatar_url":"https://avatars2.githubusercontent.com/u/1659771?v=4","gravatar_id":"","url":"https://api.github.com/users/kristw","html_url":"https://github.com/kristw","followers_url":"https://api.github.com/users/kristw/followers","following_url":"https://api.github.com/users/kristw/following{/other_user}","gists_url":"https://api.github.com/users/kristw/gists{/gist_id}","starred_url":"https://api.github.com/users/kristw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kristw/subscriptions","organizations_url":"https://api.github.com/users/kristw/orgs","repos_url":"https://api.github.com/users/kristw/repos","events_url":"https://api.github.com/users/kristw/events{/privacy}","received_events_url":"https://api.github.com/users/kristw/received_events","type":"User","site_admin":false},"body":"👍 ","created_at":"2018-11-29T19:10:22Z","updated_at":"2018-11-29T19:10:22Z","html_url":"https://github.com/apache-superset/superset-ui/pull/38#discussion_r237620603","pull_request_url":"https://api.github.com/repos/apache-superset/superset-ui/pulls/38","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache-superset/superset-ui/pulls/comments/237620603"},"html":{"href":"https://github.com/apache-superset/superset-ui/pull/38#discussion_r237620603"},"pull_request":{"href":"https://api.github.com/repos/apache-superset/superset-ui/pulls/38"}},"in_reply_to_id":236373582},"pull_request":{"url":"https://api.github.com/repos/apache-superset/superset-ui/pulls/38","id":231777400,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxNzc3NDAw","html_url":"https://github.com/apache-superset/superset-ui/pull/38","diff_url":"https://github.com/apache-superset/superset-ui/pull/38.diff","patch_url":"https://github.com/apache-superset/superset-ui/pull/38.patch","issue_url":"https://api.github.com/repos/apache-superset/superset-ui/issues/38","number":38,"state":"open","locked":false,"title":"Add @superset-ui/time-format","user":{"login":"kristw","id":1659771,"node_id":"MDQ6VXNlcjE2NTk3NzE=","avatar_url":"https://avatars2.githubusercontent.com/u/1659771?v=4","gravatar_id":"","url":"https://api.github.com/users/kristw","html_url":"https://github.com/kristw","followers_url":"https://api.github.com/users/kristw/followers","following_url":"https://api.github.com/users/kristw/following{/other_user}","gists_url":"https://api.github.com/users/kristw/gists{/gist_id}","starred_url":"https://api.github.com/users/kristw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kristw/subscriptions","organizations_url":"https://api.github.com/users/kristw/orgs","repos_url":"https://api.github.com/users/kristw/repos","events_url":"https://api.github.com/users/kristw/events{/privacy}","received_events_url":"https://api.github.com/users/kristw/received_events","type":"User","site_admin":false},"body":"🏆 Enhancements\r\n\r\nAdd `@superset-ui/time-format`, a module for formatting time. Functions `getTimeFormatter` and `formatTime` should be used instead of calling `d3.format` directly.\r\n\r\n```js\r\nimport { getTimeFormatter } from '@superset-ui/time-format';\r\nconst formatter = getTimeFormatter('%Y-%m-d');\r\nconsole.log(formatter(new Date()));\r\n```\r\n\r\nor\r\n\r\n```js\r\nimport { formatTime } from '@superset-ui/time-format';\r\nconsole.log(formatTime('%Y-%m-d', new Date()));\r\n```\r\n\r\nIt is powered by a registry to support registration of custom formatting, with fallback to `d3.utcFormat` or `d3.timeFormat` (if the formatId starts with `local!`)\r\n\r\n```js\r\nimport { getTimeFormatterRegistry, formatTime, TimeFormatter } from '@superset-ui/time-format';\r\n\r\ngetTimeFormatterRegistry().registerValue('my_format', new TimeFormatter({\r\n  id: 'my_format',\r\n  formatFunc: v => `my special format of ${utcFormat('%Y')(v)}`\r\n});\r\n\r\nconsole.log(formatTime('my_format', new Date(2018)));\r\n// prints 'my special format of 2018'\r\n```\r\n\r\nIt also define constants for common d3 time formats. See `TimeFormats.js`.\r\n\r\n```js\r\nimport { TimeFormats } from '@superset-ui/time-format';\r\n\r\nTimeFormats.DATABASE_DATETIME // '%Y-%m-%d %H:%M:%S'\r\nTimeFormats.US_DATE // '%m/%d/%Y'\r\n```\r\n","created_at":"2018-11-18T09:20:09Z","updated_at":"2018-11-29T19:10:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6453bcd668d672a29dd188f55f9aea5029289a90","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1106051895,"node_id":"MDU6TGFiZWwxMTA2MDUxODk1","url":"https://api.github.com/repos/apache-superset/superset-ui/labels/reviewable","name":"reviewable","color":"ed82dd","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/apache-superset/superset-ui/pulls/38/commits","review_comments_url":"https://api.github.com/repos/apache-superset/superset-ui/pulls/38/comments","review_comment_url":"https://api.github.com/repos/apache-superset/superset-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache-superset/superset-ui/issues/38/comments","statuses_url":"https://api.github.com/repos/apache-superset/superset-ui/statuses/ab70b9b8bf390ce1d047264ef292679a5a5f611b","head":{"label":"apache-superset:kristw--time-format","ref":"kristw--time-format","sha":"ab70b9b8bf390ce1d047264ef292679a5a5f611b","user":{"login":"apache-superset","id":42724554,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyNzI0NTU0","avatar_url":"https://avatars3.githubusercontent.com/u/42724554?v=4","gravatar_id":"","url":"https://api.github.com/users/apache-superset","html_url":"https://github.com/apache-superset","followers_url":"https://api.github.com/users/apache-superset/followers","following_url":"https://api.github.com/users/apache-superset/following{/other_user}","gists_url":"https://api.github.com/users/apache-superset/gists{/gist_id}","starred_url":"https://api.github.com/users/apache-superset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache-superset/subscriptions","organizations_url":"https://api.github.com/users/apache-superset/orgs","repos_url":"https://api.github.com/users/apache-superset/repos","events_url":"https://api.github.com/users/apache-superset/events{/privacy}","received_events_url":"https://api.github.com/users/apache-superset/received_events","type":"Organization","site_admin":false},"repo":{"id":146225651,"node_id":"MDEwOlJlcG9zaXRvcnkxNDYyMjU2NTE=","name":"superset-ui","full_name":"apache-superset/superset-ui","private":false,"owner":{"login":"apache-superset","id":42724554,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyNzI0NTU0","avatar_url":"https://avatars3.githubusercontent.com/u/42724554?v=4","gravatar_id":"","url":"https://api.github.com/users/apache-superset","html_url":"https://github.com/apache-superset","followers_url":"https://api.github.com/users/apache-superset/followers","following_url":"https://api.github.com/users/apache-superset/following{/other_user}","gists_url":"https://api.github.com/users/apache-superset/gists{/gist_id}","starred_url":"https://api.github.com/users/apache-superset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache-superset/subscriptions","organizations_url":"https://api.github.com/users/apache-superset/orgs","repos_url":"https://api.github.com/users/apache-superset/repos","events_url":"https://api.github.com/users/apache-superset/events{/privacy}","received_events_url":"https://api.github.com/users/apache-superset/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache-superset/superset-ui","description":"Apache Superset UI packages ","fork":false,"url":"https://api.github.com/repos/apache-superset/superset-ui","forks_url":"https://api.github.com/repos/apache-superset/superset-ui/forks","keys_url":"https://api.github.com/repos/apache-superset/superset-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache-superset/superset-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache-superset/superset-ui/teams","hooks_url":"https://api.github.com/repos/apache-superset/superset-ui/hooks","issue_events_url":"https://api.github.com/repos/apache-superset/superset-ui/issues/events{/number}","events_url":"https://api.github.com/repos/apache-superset/superset-ui/events","assignees_url":"https://api.github.com/repos/apache-superset/superset-ui/assignees{/user}","branches_url":"https://api.github.com/repos/apache-superset/superset-ui/branches{/branch}","tags_url":"https://api.github.com/repos/apache-superset/superset-ui/tags","blobs_url":"https://api.github.com/repos/apache-superset/superset-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache-superset/superset-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache-superset/superset-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache-superset/superset-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache-superset/superset-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/apache-superset/superset-ui/languages","stargazers_url":"https://api.github.com/repos/apache-superset/superset-ui/stargazers","contributors_url":"https://api.github.com/repos/apache-superset/superset-ui/contributors","subscribers_url":"https://api.github.com/repos/apache-superset/superset-ui/subscribers","subscription_url":"https://api.github.com/repos/apache-superset/superset-ui/subscription","commits_url":"https://api.github.com/repos/apache-superset/superset-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache-superset/superset-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache-superset/superset-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache-superset/superset-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache-superset/superset-ui/contents/{+path}","compare_url":"https://api.github.com/repos/apache-superset/superset-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache-superset/superset-ui/merges","archive_url":"https://api.github.com/repos/apache-superset/superset-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache-superset/superset-ui/downloads","issues_url":"https://api.github.com/repos/apache-superset/superset-ui/issues{/number}","pulls_url":"https://api.github.com/repos/apache-superset/superset-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/apache-superset/superset-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/apache-superset/superset-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache-superset/superset-ui/labels{/name}","releases_url":"https://api.github.com/repos/apache-superset/superset-ui/releases{/id}","deployments_url":"https://api.github.com/repos/apache-superset/superset-ui/deployments","created_at":"2018-08-26T23:57:22Z","updated_at":"2018-11-29T17:48:21Z","pushed_at":"2018-11-29T17:48:22Z","git_url":"git://github.com/apache-superset/superset-ui.git","ssh_url":"git@github.com:apache-superset/superset-ui.git","clone_url":"https://github.com/apache-superset/superset-ui.git","svn_url":"https://github.com/apache-superset/superset-ui","homepage":"","size":952,"stargazers_count":18,"watchers_count":18,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2,"open_issues":2,"watchers":18,"default_branch":"master"}},"base":{"label":"apache-superset:master","ref":"master","sha":"c87e6ac35a4530b522bc019678f4be45cca22298","user":{"login":"apache-superset","id":42724554,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyNzI0NTU0","avatar_url":"https://avatars3.githubusercontent.com/u/42724554?v=4","gravatar_id":"","url":"https://api.github.com/users/apache-superset","html_url":"https://github.com/apache-superset","followers_url":"https://api.github.com/users/apache-superset/followers","following_url":"https://api.github.com/users/apache-superset/following{/other_user}","gists_url":"https://api.github.com/users/apache-superset/gists{/gist_id}","starred_url":"https://api.github.com/users/apache-superset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache-superset/subscriptions","organizations_url":"https://api.github.com/users/apache-superset/orgs","repos_url":"https://api.github.com/users/apache-superset/repos","events_url":"https://api.github.com/users/apache-superset/events{/privacy}","received_events_url":"https://api.github.com/users/apache-superset/received_events","type":"Organization","site_admin":false},"repo":{"id":146225651,"node_id":"MDEwOlJlcG9zaXRvcnkxNDYyMjU2NTE=","name":"superset-ui","full_name":"apache-superset/superset-ui","private":false,"owner":{"login":"apache-superset","id":42724554,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyNzI0NTU0","avatar_url":"https://avatars3.githubusercontent.com/u/42724554?v=4","gravatar_id":"","url":"https://api.github.com/users/apache-superset","html_url":"https://github.com/apache-superset","followers_url":"https://api.github.com/users/apache-superset/followers","following_url":"https://api.github.com/users/apache-superset/following{/other_user}","gists_url":"https://api.github.com/users/apache-superset/gists{/gist_id}","starred_url":"https://api.github.com/users/apache-superset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache-superset/subscriptions","organizations_url":"https://api.github.com/users/apache-superset/orgs","repos_url":"https://api.github.com/users/apache-superset/repos","events_url":"https://api.github.com/users/apache-superset/events{/privacy}","received_events_url":"https://api.github.com/users/apache-superset/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache-superset/superset-ui","description":"Apache Superset UI packages ","fork":false,"url":"https://api.github.com/repos/apache-superset/superset-ui","forks_url":"https://api.github.com/repos/apache-superset/superset-ui/forks","keys_url":"https://api.github.com/repos/apache-superset/superset-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache-superset/superset-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache-superset/superset-ui/teams","hooks_url":"https://api.github.com/repos/apache-superset/superset-ui/hooks","issue_events_url":"https://api.github.com/repos/apache-superset/superset-ui/issues/events{/number}","events_url":"https://api.github.com/repos/apache-superset/superset-ui/events","assignees_url":"https://api.github.com/repos/apache-superset/superset-ui/assignees{/user}","branches_url":"https://api.github.com/repos/apache-superset/superset-ui/branches{/branch}","tags_url":"https://api.github.com/repos/apache-superset/superset-ui/tags","blobs_url":"https://api.github.com/repos/apache-superset/superset-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache-superset/superset-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache-superset/superset-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache-superset/superset-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache-superset/superset-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/apache-superset/superset-ui/languages","stargazers_url":"https://api.github.com/repos/apache-superset/superset-ui/stargazers","contributors_url":"https://api.github.com/repos/apache-superset/superset-ui/contributors","subscribers_url":"https://api.github.com/repos/apache-superset/superset-ui/subscribers","subscription_url":"https://api.github.com/repos/apache-superset/superset-ui/subscription","commits_url":"https://api.github.com/repos/apache-superset/superset-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache-superset/superset-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache-superset/superset-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache-superset/superset-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache-superset/superset-ui/contents/{+path}","compare_url":"https://api.github.com/repos/apache-superset/superset-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache-superset/superset-ui/merges","archive_url":"https://api.github.com/repos/apache-superset/superset-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache-superset/superset-ui/downloads","issues_url":"https://api.github.com/repos/apache-superset/superset-ui/issues{/number}","pulls_url":"https://api.github.com/repos/apache-superset/superset-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/apache-superset/superset-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/apache-superset/superset-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache-superset/superset-ui/labels{/name}","releases_url":"https://api.github.com/repos/apache-superset/superset-ui/releases{/id}","deployments_url":"https://api.github.com/repos/apache-superset/superset-ui/deployments","created_at":"2018-08-26T23:57:22Z","updated_at":"2018-11-29T17:48:21Z","pushed_at":"2018-11-29T17:48:22Z","git_url":"git://github.com/apache-superset/superset-ui.git","ssh_url":"git@github.com:apache-superset/superset-ui.git","clone_url":"https://github.com/apache-superset/superset-ui.git","svn_url":"https://github.com/apache-superset/superset-ui","homepage":"","size":952,"stargazers_count":18,"watchers_count":18,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2,"open_issues":2,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache-superset/superset-ui/pulls/38"},"html":{"href":"https://github.com/apache-superset/superset-ui/pull/38"},"issue":{"href":"https://api.github.com/repos/apache-superset/superset-ui/issues/38"},"comments":{"href":"https://api.github.com/repos/apache-superset/superset-ui/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/apache-superset/superset-ui/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/apache-superset/superset-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache-superset/superset-ui/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/apache-superset/superset-ui/statuses/ab70b9b8bf390ce1d047264ef292679a5a5f611b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kristw"}}