After looking at client/templates/vue/src/main/webapp/app/shared/date/filters.ts.ejs, I saw that we used two date libs instead of one.
Is there a reason for that? Having used date-fns, I can say it provides everything we need.
It was introduced when fixing the display of duration
cc @atomfrede : maybe you can answer ?
We should not use moment in vue. We use date-fns and duration-fns as date-fns does not (yet) support parsing an iso duration (at least when I tried it). parseISO returns a date and not a duration. So duration-fns is used to parse an iso duration string into a duration which can be formatted by date-fns.
See for example https://github.com/date-fns/date-fns/issues/418
EDIT: vue does not use moment anywhere
We should probably remove moment from the other frontends as well as it seems the project is being deprecated : https://momentjs.com/docs/#/-project-status/
We used the vue blueprint to see if we can do it without moment and eventually do the same for angular/react (at least that was the plan). Maybe the time has come.
I also think it could be the moment to replace moment in the project and use the same library everytime. Did you consider using DayJS that is described as "designed to be a minimalist replacement for Moment.js" by Moment on their project status page.
To my mind, DaysJS API would be easier to use in replacement of moment than date-fns's one, but I don't have that much experience with date-fns. What do you think?
I did consider it when adding the date/time functions to the vuejs blueprint, but I can recall why I did not use dayjs eventually. It looks nice indeed (and I can see it has a missing feature). I will give it try and we could change to dayjs for all frontends.
Should I close this issue and create a new one for the migration/removal of moment?
yes, let's create a new ticket for better visibility
@pascalgrimaud or @atomfrede Could you assign the new issue to @FabienEssid and me please?
We'd like to try to fix this one
Going to close this. Follow up discussion via https://github.com/jhipster/generator-jhipster/issues/12575
Most helpful comment
We used the vue blueprint to see if we can do it without moment and eventually do the same for angular/react (at least that was the plan). Maybe the time has come.