Skip to content

Conversation

@Johannestegner
Copy link
Member

Type of change

  • New feature
  • Bug fix
  • Security patch
  • Documentation update

Description

This PR does two things:

  • Fixes issue where future dates returns positive age.
  • Adds a new option, clock, which implements the PSR-20 ClockInterface to allow abstraction of DateTime.

I'm not 100% sure that we want to document the clock option as of now, but seeing it's visible by default in the C# package, I exposed it here as well.

Related issue

#65

Motivation

Bugfix motivation is quite obvious, we want the bug fixed!

The ClockInterface part is primarily to make the code easier to test, while allowing the modification of time might be a good feature to expose to the users as well. The Abstraction is in my opinion something that we do want, the visible option I'm less sure about.

Checklist

  • I have read the CONTRIBUTING document.
  • I have read and accepted the Code of conduct
  • Tests passes.
  • Style lints passes.
  • Documentation is updated.

Created a system clock.

Signed-off-by: Johannes Tegnér <johannes@jitesoft.com>
Signed-off-by: Johannes Tegnér <johannes@jitesoft.com>
Signed-off-by: Johannes Tegnér <johannes@jitesoft.com>
Signed-off-by: Johannes Tegnér <johannes@jitesoft.com>
Signed-off-by: Johannes Tegnér <johannes@jitesoft.com>
@Johannestegner Johannestegner merged commit 1be4bcb into personnummer:master Jan 13, 2025
4 checks passed
@Johannestegner Johannestegner deleted the hotfix/get-age branch January 13, 2025 16:01
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