

One is the method I wrote myself, and one is dayjs. There's a big difference in performance
@Likunone Vanilla js is of course and always the best in performance. However, a lib dose more than just a single date compare.
That is to say, there's no need for this comparison. Besides, Day.js is still fast enough even in your 300000 times tests.
Fair comparison is with other Date libs (moment, luxon, date-fns, etc), not with vanilla js
Most helpful comment
@Likunone Vanilla js is of course and always the best in performance. However, a lib dose more than just a single date compare.
That is to say, there's no need for this comparison. Besides, Day.js is still fast enough even in your 300000 times tests.