Skip to navigation
Get the days between javascript date objects
24.01.23
const from = new Date(filter['date_from'].substring(0,4) + '-' + filter['date_from'].substring(4,6) + '-' + filter['date_from'].substring(6,8)); const until = new Date(filter['date_until'].substring(0,4) + '-' + filter['date_until'].substring(4,6) + '-' + filter['date_until'].substring(6,8)); const oneday = 1000 * 60 * 60 * 24; const diffs = until.getTime() - from.getTime(); const days = Math.round(diffs / oneday) console.log(days);
https://stackabuse.com/javascript-get-number-of-days-between-dates/
Reply
Anonymous
Information Epoch 1732461097
Worse is better.
Home
Notebook
Contact us