Download Functions to work with dates in JavaScript https://date-fns.org/docs/Getting-Started npm install date-fns --save import { formatDistance } from 'date-fns' differenceInDays // How many full days are between // 2 July 2011 23:00:00 and 2 July 2012 00:00:00? const result = differenceInDays( new Date(2012, 6, 2, 0, 0), new Date(2011, 6, 2, 23, 0) ) //=> 365