How to use the library MomentJs

Has anyone used or knows how to use the MomentJs library ( on WeWeb?

I advise not to use moment, as this is a deprecated library.
What is your usecase?
You can use

  • Our date plugin
  • Native browser date function (a lot of them are available now)
  • An other more modern and light library, like Date-fns

I tried to use the plugin, but I can’t bring the time in hours/minutes/seconds between two dates and also display something like “3 hours ago”"
In the case of Date-Fns, how would you use it?

Depending on your usage:

  • if you just need a text which will display “6 months ago”, custom component is the way to go
  • If you want formula to use in different places, custom plugin is the way to go (but you need to contact us for this, as it is not available for everyone at the moment)
  • You can always hack by loading the script yourself (through the CDN version), but you may have difficulty to handle this properly at first load and inside the editor

Please don’t hesitate to make a feature request on so we can put it in the backlog and improve the date plugin according to your needs. We could add a formula in the date plugin to achieve the “3 hours ago” thing for example!

This would be perfect, as it is very common in many solutions. I’m sure implementing this feature will benefit everyone.

1 Like

In luxon, the toRelative method gives you the kind of notation you are looking for: DateTime | Luxon

In the event you want to pull in, say, Luxon (which does this kind of date comparison and display job well) and you want access in the editor, paste the script tag you can get here: into our weweb converter here: to generate a custom javascript step you can put into your page load to have access to luxon.


Do you think it is possible to implement Iconify using this converter?

If so, can you give an example?

Ask and ye shall receive: Speedrun - Connect Iconify to Weweb in under 10 minutes


Doesweweb expose a date library already

Nice work Ray!! I recently implemented moment just to have time outputs like: 10 AM EST

Thank you

1 Like