Formating current date / time in multiple format with multiple output and simple calculation

Hi everyone!

I've just developed a new Node-RED node called Date Injector, and I have to say, developing for Node-RED has been a real blast! This node is a bit like simpletime, but I hope it's even more versatile :wink:

With Date Injector, you can:

  • Inject the current date and time into your flows
  • Customize the format using Day.js, thanks to them.
  • Add or subtract time with units like years, days, hours, etc.
  • Support for multiple languages (English, French, Spanish, and more)

I had a great time building it, and I hope you'll find it useful in your flows! I'd love to hear your thoughts and feedback.

4 Likes

Well done @fdecourt

We have been waiting for someone to introduce day.js to Node RED.

If I may - have you considered mirroring the work of our very own @TotallyInformation and his moment node?

I am sure @TotallyInformation will contribute/add valuable ideas to make it happen?

This is not to draw attention away from this post - but you seem to be on fire with contributing to Node RED currently :pray:

@marcus-j-davies - Moment is now in maintenance mode. See their status page - Moment.js | Docs

1 Like

[quote="marcus-j-davies, post:2, topic:91149"]
Thank you for the feedback!

Yes, I looked into what @TotallyInformation offered with the Moment node, but since Moment.js is no longer being updated, I decided to move away from it. I also explored JSONata, but it didn't quite achieve what I was looking for. I considered simpletime as well, but again, it didn't fully match my requirements. That’s why I went with Day.js and developp this node.

However, I plan to incorporate some of the great ideas from @TotallyInformation into my node, especially the ability to inject dates (priority one), the option to select timezones, and other... my node is in alpha version (just did it today !)

Yup - hence why I think a day.js equivalent should be considered? :smiling_imp:

Planting seeds boys, planting seeds...

BUT - not to distract, please see the opener of this thread :innocent:

1 Like

I will try to duplicate the moment node with the day.js one !

2 Likes

The preferred protocol is to offer to update @TotallyInformation's moment node in the first instance, instead of duplicating it.. :wink:

EDIT - but I guess it wouldn't be node-red-contrib-moment if it used day.js and not moment :dizzy_face:

1 Like

Right, I'll contact him

1 Like

@fdecourt has reached out and I've offered to open up the repo to them for the creation of a new node, perhaps a dayjs node? I can help with some testing and re-publishing.

4 Likes

I think we can keep the legacy name, people generally recognise it anyway. I've suggested a new node in the same package so people get plenty of time to move over as they feel the need.

Should be easy enough to start by duplicating the existing node and re-engineering with the day.js library. Hopefully adding a few tweaks to bring the programming up to 2020's code instead of 2010's code. :grinning:

3 Likes