You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is expected behavior. The idea is that all methods on the Sugar.Date object are static methods that always return native objects, while it is required to either extend or use chainables with new Sugar.Date() for objects with extended functionality.
I realize that the signature Sugar.Date.create lends to the thinking that it would return a Sugar date as opposed to a normal one, and I also find it a bit annoying that it feels somewhat misleading. One idea I've had is to change the naming of create to parse.. Note also that this method is automatically when creating chainables so that you can do something like new Sugar.Date('tomorrow') instead of needing to do new Sugar.Date(Sugar.Date.create('tomorrow')).
I'm open to other suggestions here to help make this more intuitive if you have them.
The title says it all. Here's an example on how to reproduce it:
For now as a work around I'm wrapping create calls with Date:
The text was updated successfully, but these errors were encountered: