Repository navigation
Conversation
There was a problem hiding this comment.
It looks like this and a few other files managed to slip in the pull request when they weren't meant to.
0ed7624 to
79578cd
Compare
79578cd to
5c968c9
Compare
|
@danielbachhuber Thanks, sorry about that. Fixed now |
|
Thanks @psealock. Flagging this for review to see if this is an API we want to expose. |
|
@psealock first off, looks like you linked to a private repo so I'm unable to review the issue you mentioned. I have concerns about exposing more than is necessary in |
There was a problem hiding this comment.
I don't think we should be exposing extra moment methods on our date object. If people want to use moment/moment's APIs they should import it directly. I think we should be exporting only what we explicitly need.
I'm not requesting changes so much as saying we shouldn't do this.
I suppose if there are particular methods (eg localData) that you want we could export them explicitly. But we then have to commit to supporting that API even if we moved away from moment under the hood. I think the aim here should be not to rely on moment's API.
| }; | ||
|
|
||
| // Make available other moment.js methods, such as moment.isMoment() | ||
| Object.keys( momentLib ).forEach( ( key ) => { |
There was a problem hiding this comment.
While I don't think we should be exporting anything at this stage, this is not the right way to expose the library either. I think it'd be better to select the APIs you want to export. Otherwise we should just be exporting a moment property that is the entire API. But looping through the keys and adding a reference is inefficient and also not great for documentation as it doesn't explicitly make clear the APIs we're exporting.
|
When we were exposing
As @tofumatt mentioned above, we don't want to maintain I'm closing this PR as won't fix. |
|
Thanks for the reviews everyone, I appreciate the comments. This comment by @gziolo clarifies the desired path for extensions using Gutenberg who require more from the momentjs api to simply use it directly.
|
Description
Momentjs has many methods on the
momentobject. Some of these are very useful. For instanceisMoment,duration, ormonthsare quite handy.In particular, woocommerce/woocommerce-admin#104 requires access to the
localDataproperty in order to determine the localized format of a user facing input.This way, we can tell how the user has input a date, e.g.
M/D/YYYYorD/M/YYYYHow has this been tested?
In the console, we can see momentjs properties available
Types of changes
New feature: Momentjs methods available from the library
Checklist: