OpenEnergyDashboard / OED

Open Energy Dashboard (OED)
Mozilla Public License 2.0
83 stars 315 forks source link

replace moment #586

Open huss opened 3 years ago

huss commented 3 years ago

The moment project has decided to wind down and recommends replacements (https://momentjs.com/docs/#/-project-status/recommendations). There are other packages and we could wait for JS to formalize its own version. While moment works, we need to change sometime.

huss commented 2 years ago

PR #760 demonstrated some of the changes needed to convert to day.js. It has been closed since we need to decide what will be used as a replacement. However, that PR is useful in thinking about this and for the actual change.

spearec commented 1 year ago

After doing some research, native javascript support for date/time, as well as durations, is a currently proposed change in the form of Temporal (https://github.com/tc39/proposal-temporal).

Temporal is currently in the stage 3 proposal phase, which means that there are unlikely to be changes to the API before it gets released. Using a polyfill, we could use this package now, even without web browser support.

Since moment still works and this feature is still in the proposal phase, there are no urgent reasons to switch over now. However, it also makes no sense to switch to another package, such as day.js or Luxon, when support for these features is close to being supported natively.