-2

I am creating an app which asks the users for 2 dates, then it calculates the time between them dates.

But the dates have seconds in them so instead of 90 minutes I am getting 89 minutes.

So I can convert this:

startTime: Sat Apr 09 2022 09:00:39 GMT+0100 (Irish Standard Time)

Into this:

startTime: Sat Apr 09 2022 09:00:00 GMT+0100 (Irish Standard Time)

I would preferably do this with DayJS

KillianCode
  • 79
  • 2
  • 9
  • 2
    Why wouldn't you just call [`setUTCSeconds`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setUTCSeconds)? – James Apr 09 '22 at 18:46

1 Answers1

0

I came up with a solution with the help of James!

values.startTime = dayjs(time[0].setUTCSeconds(0)).toDate();

Thank you!

KillianCode
  • 79
  • 2
  • 9