Release 1.6.0: return parsed EPP dates in UTC - #59
Merged
Merged
Conversation
RFC 5731 s2.4, 5732 s2.4 and 5733 s2.7 require every date-time to be UTC. The library parsed dates with DateTime.TryParse, which converts values with a Z to the machine's local time, so ExDate and the Nominet dates depended on where the code ran. Parse them through a shared EppDateTime helper that returns DateTimeKind.Utc, converts offsets to UTC and treats values without a zone designator (some of Nominet's examples omit the Z) as UTC. DomainRenew parsed curExpDate the same way before truncating it to a date, so a full exDate such as 2000-04-03T22:00:00.0Z became 2000-04-04 east of UTC and the registry would reject the renew. Also format the Smallregistry birthDate with the invariant culture. Bump to 1.6.0: callers now get UTC values instead of local time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What the specs say
T/Zform. RFC 5730 §2.4 sayssvDateis UTC.curExpDateis anxs:date, with no time.notAfter/acceptedDatearedateTime, and every example is UTC. The library already sends these as UTC; unchanged.Zand some don't, sometimes within one message (in Registrar Change,qDatehasZbutcrDate/exDatedon't). There is no timezone statement, andsvDateis documented as UTC.Changes
EppDateTimehelper. It parses with the invariant culture andAssumeUniversal | AdjustToUniversal, and returnsDateTimeKind.Utc. Values with an offset are converted to UTC. Values without a zone designator are taken as UTC, per the EPP rule.DomainRenewResponse.ExDateDataQuality.DateCommencedandDateToSuspendAbuseNotification.DateDomainsSuspendedNotification.CancelDateDomainRenew:curExpDatewas derived from a local-time conversion, so a fullexDatesuch as2000-04-03T22:00:00.0Zbecame2000-04-04east of UTC, and the registry would reject the renew.birthDate: now formatted with the invariant culture. It previously depended on the current culture's calendar.crDate,upDate,exDateon info responses,qDateand so on are exposed as raw strings and stay as they were.Testing
TestDomainRenewResponse1:ExDateis UTC. This replaces anInconclusiveplaceholder.TestDomainRenewCommandWithUtcDateTime:curExpDatestays2000-04-03.DateTimeKind.Utc.TZset to Asia/Tokyo, America/New_York, UTC and Pacific/Kiritimati.TZ=Asia/Tokyo, all 5 date tests fail.🤖 Generated with Claude Code