jest-date-mock icon indicating copy to clipboard operation
jest-date-mock copied to clipboard

Missing comparison section in README

Open luckylooke opened this issue 3 years ago • 2 comments

Hello 👋

Could you please add section to README where you provide comparison to jest Fake timers API ?

Thanks 🙏

luckylooke avatar May 24 '22 06:05 luckylooke

One is date API, one is timer. Why need a section to compare them?

hustcc avatar Aug 08 '22 05:08 hustcc

Both are operating with time and seems the same way.. so I wanted to know why should I use this library over official API 🤷

jest-date-mock

advanceTo(new Date(2018, 5, 27, 0, 0, 0)); // reset to date time.

seems to be same as https://jestjs.io/docs/jest-object#jestsetsystemtimenow-number--date

jest-date-mock

advanceBy(3000); // advance time 3 seconds

seems to be same as https://jestjs.io/docs/jest-object#jestadvancetimersbytimemstorun

Thanks 🙏

luckylooke avatar Aug 08 '22 06:08 luckylooke

Date and timer is not same.

  • Date is for calendar
  • timer is for setTimeout or setInterval

hustcc avatar Oct 13 '22 06:10 hustcc