0 votes
712 views
in Jquery by
How to find difference between two dates? Is there a lightweight library?

1 Answer

0 votes
by
Yes, you can use Jquery calendar, Moment.js, Day.js etc

I personanlly recommend the Day.js as its very lightweight

<script src="https://unpkg.com/dayjs@1.8.21/dayjs.min.js"></script>
<script>dayjs().format()</script>

    const date1 = dayjs('2019-01-25')
    const date2 = dayjs('2019-01-26')
    var diff = date1.diff(date2, 'day')

Related questions

0 votes
1 answer 846 views
0 votes
1 answer 1.5k views
0 votes
1 answer 784 views
0 votes
1 answer 725 views
0 votes
1 answer 710 views
0 votes
1 answer 638 views
asked May 25, 2021 in General by Tester jjavelin (120 points)
...