0 votes
526 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 628 views
0 votes
1 answer 1.4k views
0 votes
1 answer 602 views
0 votes
1 answer 619 views
0 votes
1 answer 608 views
0 votes
1 answer 542 views
asked May 25, 2021 in General by Tester jjavelin (120 points)
...