Closed ilucin closed 7 months ago
Yes, I would consider it
The idea is that every action (e.g. onSelect
) receives an object, not a Date. That object contains a date
property that contains the native Date
object. That object at the moment also has a moment
property that has the moment-equivalent version of that date, so people can decide what kind of value they want by doing onSelect=(action "whatever" value="moment")
.
I'd like to maintain the API, but if we remove momentjs the moment
property wouldn't be there. The same way, if someone prefers datejs
, we could have a datejs
property on that object.
That said, it's pretty low in my scale of priorities.
Great! If you think this is generally a good idea I can try to help you with implementation.
As I can see it, the way to refactor this would be:
Of course, maintaining an existing API is important but ember-power-calendar is still in alpha so changes like this are expected.
On the other hand, we can provide a simple migration mechanism for people that still want their moment
property to be there. Maybe allow them to reopen power-calendar component class and set moment property on their own and then power-calendar can use it internally (only if provided) when exposing data in actions.
The challenge is that I use momentjs myself quite a lot internally. Helper functions are reasonably easy to implement, but i18n can be too much. There is a ton of knowledge in momentjs that it's not easy to replicate.
You're right. I wouldn't replicate it then, only allow to opt-out of it.
It a very old issue, but power calendar is already working with meta packages for moment, luxon... There is possible to make also custom meta packages, so evey can use his favorite date libary
Hi @cibernox! Would you consider removing moment dependency? Many people are using alternatives like date-fns or others.
I believe a good plugin shouldn't force you (if possible) too use big dependencies like that one. I really like your work with ember-power plugin family but this is kind of a deal breaker for my projects.