Skip to content

Use DatetimeProvider instead of javascript Date #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

meysam7289
Copy link

Using DatetimeProvider instead of javascript Date.
This is useful for the case that client time not synchronized with IdP server.
You can implement custom DatetimeProvider and use server time.

Using DatetimeProvider instead of javascript Date.
This is useful for the case that client time not synchronized with IdP server.
You can implement custom DatetimeProvider and use server time.
@jeroenheijmans
Copy link
Collaborator

Some initial remarks:

  • Your last commit should probably be removed, as it does not "fix bug" as the commit message says, but instead changes the supposed Author, name, and ID of the repository
  • It might be good to add some documentation for this to your PR

In general the PR seems like an improvement to me, if not for the case you mention, then for the option of better testing.

@manfredsteyer
Copy link
Owner

@jeroenheijmans What do you think?

@jeroenheijmans
Copy link
Collaborator

jeroenheijmans commented Mar 5, 2020

Well, I:

  • love the idea, decoupling the service from Date is useful (in my mind slightly less for OP's situation, and more so for testing, mocking, and whatnot)
  • think the PR touches way too many files for what it tries to do (though that might be a result from the fact that the PR sat there for a while?)
  • think the PR makes a few unintended(?) bad changes, e.g. changing package.json
  • love tests, especially for libs like this repo, but only like it if we'd go all-in (and not add only a couple of tests, which IMHO adds a false sense of security)
  • EDIT: Helps with folks like OP in wrong invalid token because of system time issues #434 too

but in general, the idea of a (Default)DateTimeProvider makes sense to me.

@manfredsteyer
Copy link
Owner

Awesome, we just merged another PR that built upon this PR. Credits ofc go to both of you.

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.

3 participants