Skip to content

Conversation

@vbudovski
Copy link
Contributor

Jest provides two different implementations of fake timers - legacy and modern. The legacy implementation works with
RRule, while the modern one does not, as it uses a strict instance check. Compare the toString result of the object if
the value is not a Date instance.


Thanks for contributing to rrule!

To submit a pull request, please verify that you have done the following:

  • Merged in or rebased on the latest master commit
  • Linked to an existing bug or issue describing the bug or feature you're
    addressing
  • Written one or more tests showing that your change works as advertised

@vbudovski vbudovski force-pushed the fix/support-mocked-dates branch 2 times, most recently from 3d3c334 to f09a9f3 Compare June 25, 2022 01:41
Jest provides two different implementations of fake timers - legacy and modern. The legacy implementation works with
RRule, while the modern one does not, as it uses a strict instance check. Compare the toString result of the object if
the value is not a Date instance.
@vbudovski vbudovski force-pushed the fix/support-mocked-dates branch from f09a9f3 to 5e96745 Compare June 25, 2022 01:45
Copy link
Collaborator

@davidgoli davidgoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

value instanceof Date ||
(typeof value === 'object' &&
Object.prototype.toString.call(value) === '[object Date]')
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the lodash isDate implementation - nice

@davidgoli
Copy link
Collaborator

Please resolve the conflicts and I'll merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants