That should work for your basic page while learning, though usually you would be better off using a date library like date-fns or luxon, as those would better handle edge cases with time zones, daylight savings, or leap years.
https://momentjs.com/ is a useful library for this exact thing.
Appwrite - The Open Source Firebase alternative introduces iOS support . Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!
Fast and Light Relative Time Strings in JS
1 project | dev.to | 24 Jan 2023
2 projects | reddit.com/r/programminghorror | 23 Jan 2023
1 project | reddit.com/r/reactjs | 17 Jan 2023
Trying to change class to green from gray if date is present in array.
1 project | reddit.com/r/vuejs | 20 Dec 2022
RSS Feed with Next.js
2 projects | dev.to | 7 Dec 2022