mirror of
https://github.com/junian/Standard.Licensing.git
synced 2026-04-25 05:45:51 +03:00
[GH-ISSUE #17] Expiration Date is not correctly compared #13
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Standard.Licensing#13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @psovit on GitHub (Aug 13, 2020).
Original GitHub issue: https://github.com/junian/Standard.Licensing/issues/17
The expiration date is set as Universal date when creating the License file (
ToUniversalTime()).But the
LicenseValidationDateextension methodExpirationDateis comparing withDateTime.Now.Shouldn't they both be consistently UniversalTime?
@skst commented on GitHub (Feb 23, 2025):
The
Expirationproperty is in UTC. TheExpirationDate()method compares the UTC value ofExpirationwith the localDateTime.Nowvalue.The workaround is to use the second
ExpirationDate(DateTime)method and pass a UTC value.Personally, I think
Expirationshould be aDateOnlyand the comparison should be against the local date.Another issue is that when the
Expirationproperty parses the DateTime value from the XML license file, theKindproperty is left asLocal. TheParseExact()method needs to add theDateTimeStyles.AdjustToUniversalstyle.@skst commented on GitHub (Feb 27, 2025):
I have created PR #47 to fix this.