这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jamesisaac
Copy link

When carrying out automated testing (e.g. with Selenium), and wanting to test different timezones, it's common to mock the global Date object with a library like: https://github.com/plaa/TimeShift-js

Unfortunately, the isDate check in pickadate has a very strict check, which rejects anything that isn't a native JS Date object, rendering this mocking method unusable.

I propose making this check more lenient, so as long as the object looks like it matches the Date API, it's allowed through.

The issue manifests itself in an interesting way -- you end up with a calendar where, in the best case, every single date shows as today, and in the worst case, browser freezes up in an infinite loop.

@jamesisaac
Copy link
Author

Not sure why Travis CI is failing - can't imagine how this would break things. Maybe to do with it being the last day of the month?

>> Message: Able to disable today
>> Actual: [
>>   2016,
>>   2,
>>   32
>> ]
>> Expected: [
>>   2016,
>>   3,
>>   1
>> ]

@DanielRuf
Copy link
Contributor

It seems it was due to the overflow. You can check this with the current master on your machine by changing the system clock.

@DanielRuf DanielRuf self-assigned this Feb 24, 2018
@DanielRuf DanielRuf self-requested a review April 1, 2018 21:59
Copy link
Contributor

@DanielRuf DanielRuf left a comment

Choose a reason for hiding this comment

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

Please rebase on the current head of master

@jamesisaac
Copy link
Author

@DanielRuf I believe that's done now. I've also ticked "Allow edits from maintainers." in case you want to change something further yourself. Thanks.

@DanielRuf DanielRuf self-requested a review May 3, 2018 21:31
Copy link
Contributor

@DanielRuf DanielRuf left a comment

Choose a reason for hiding this comment

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

The changes probably cause the failing unit tests.

Can you investigate and test them?

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