I am developing an application with React Native. I will take the local date of the user and save it to the database. It doesn't matter to me the hour, minute or second. So I want to reset them. My purpose in resetting is to be able to compare dates more easily. Just let me record the date of that day correctly is enough for me. The code below looks fine to me but I'm not sure of its correctness.
There are a lot of ideas about date operations, but there are time differences according to countries, summer time, winter time, etc. I wanted to open this topic beforehand in order not to have problems with such issues.
const today = new Date();
today.setUTCHours(0, 0, 0, 0);
console.log(today);
// output: 2023-06-15T00:00:00.000Z