There is a nice example in StackOverflow here:
It uses only JavaScript APIs, so will work in both public and backend code.
The idea is that JavaScript time is in milliseconds, so if you cadd 24 * 60 * 60 * 1000 milliseconds, you will effectively add a day.
When writing backend functions, you can also use momentjs npm module, which makes time arithmetic easier.