0 votes
968 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 1.1k views
0 votes
1 answer 1.8k views
0 votes
1 answer 1.0k views
0 votes
1 answer 860 views
0 votes
1 answer 847 views
0 votes
1 answer 795 views
asked May 25, 2021 in General by Tester jjavelin (120 points)
...