Skip to content

Fix parsing of Expiration. Fix comparison of Expiration. Add unit tests.#47

Open
skst wants to merge 3 commits intojunian:masterfrom
12noonLLC:expiration-fixes
Open

Fix parsing of Expiration. Fix comparison of Expiration. Add unit tests.#47
skst wants to merge 3 commits intojunian:masterfrom
12noonLLC:expiration-fixes

Conversation

@skst
Copy link
Copy Markdown

@skst skst commented Feb 27, 2025

This PR fixes #17.

  • The Expiration property was returning an Unspecified DateTime type. Added the AdjustToUniversal style to Parse.
  • Convert DateTime passed to ExpirationDate to UTC before comparing with Expiration property (which is UTC).
  • Added a validation to Expiration.set to ensure the incoming type is not Unspecified.
  • Added a validation to ExpiresAt to ensure the incoming type is not Unspecified.
  • Added more unit tests around ExpiresAt and Expiration.
  • All unit tests pass.

This is my first pull request ever. 🙂 I tried to add relevant tests and to maintain the project's coding style (indents, spaces not tabs, etc.). If I introduced an error or missed something, please let me know, and I will be happy to correct it.

@skst skst force-pushed the expiration-fixes branch 4 times, most recently from b2ae881 to 49b6d4b Compare April 26, 2026 05:29
@skst skst force-pushed the expiration-fixes branch from efc11f8 to ff66969 Compare April 26, 2026 06:07
@skst
Copy link
Copy Markdown
Author

skst commented Apr 26, 2026

I have updated the pull request to ensure time-zone-agnostic comparisons with the expiration date. The date/time passed to Expiration and ExpiresAt is treated as a date only--the time and time zone are ignored. ExpirationDate similarly ignores the passed time and time zone and uses only the date component to compare with the stored expiry date. This way, a license always expires at midnight local time. Granted, this may give a user a few hours less or more of usage, but it's consistent with user expectations.

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.

Expiration Date is not correctly compared

1 participant