-
Notifications
You must be signed in to change notification settings - Fork 222
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add some documentation on 1. when would someone want to use this utility 2. how would someone use this utility.
4d4d720
to
4bd303c
Compare
@michenly Oh, didn't realize there was documentation in the readme, sorry. Should be good now 🙂 |
hour: 'numeric', | ||
}; | ||
|
||
const newDate = formatDate(date, locales, options); // 9 AM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new date is just 9 AM
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's based on the options you pass it apparently. By doing hour: 'numeric'
it'll just return the hour. If you don't specify hour it'll give you the date like this 2/18/2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great to me!
Description
This exports the
formatDate
function so we can reuse it in@shopify/react-i18n
and in shopify web directly. This will reduce code duplication and hopefully also eliminate more memory leaks once we use it.I'll put up a follow-up PR for the
@shopify/react-i18n
package that makes use of this function.Follow up PR: #1287
Type of change
Checklist