(In general, I'm still trying to understand adding packages with plugins to Node-RED. If anyone can point me to a document and/or tutorial I'd greatly appreciate it.)
I missed the beginning of the thread and answered you as if you were doing the code in a function node since you mentioned functionGlobalContext which is the old method of gaining access to modules in a function (which is why I pointed you to the article)
Happy for the PR but "alongside"? Bah! This is just more code to maintain. We are not great at depreciating things.
We may wish to explore introducing it via a setting that exclusively choses one or the other (not both) with the aim to remove Moment at some future point.
An alternative approach could be to drop moment and mimic its functionality using dayjs? for example moment.isMoment could be mapped to call dayJs.isDayjs however i am not 100% certain all functionality of moment can be so easily proxied to dayjs functionality.
You could always mark it as about to be deprecated, then set a future version as the endpoint. Probably should be quite a while ahead though as some folk don't seem very good and updates.
If Moment could be transparently replaced though, I guess that would be even better.
My plan was going to be add $dayjs() to the list (not touching $moment())
and for the project to start favouring day.js over moment - in view of it being removed in the future.
if I may @Steve-Mcl I'll PR the dayjs addition as the foundation?
There is no reason you cannot make a start TBF, but I would personally be against duplication without a clear path to final migration. Something agreed with clear outlines.
Given the tiny library size of dayjs I wouldn't be worried about having both for a while. I think we should then announce that moment will be deprecated in Node-RED v5 and removed in v6.
I would fully support adding dayjs as a standard part of Node-RED. It takes a little adjustment, but since moment.js is deprecated, it is time to start moving on to something else.
It will eventually. But I wouldn't worry too much, I'm certainly not about to get rid of it and it looks like the MomentJS library isn't in a hurry to die either. There are rather a lot of other projects that still rely on it.
However, good news is that @fdecourt is working on a new node using DayJS that mirrors my old moment node as closely as possible. Hopefully it will be easy to switch over.