Skip to content

Conversation

@wheata03
Copy link

@wheata03 wheata03 commented Apr 3, 2024

In generating #10 I discovered that six of the unit tests did not pass. This was an odd failure. With some extra debugging I traced the failure to be checked at MyDifferenceEvaluator; where it is converting both sides of the test comparison to milliseconds.

With some extra logging I get:

Durations were different: P100Y -> 3155763600000 / PT876600H -> 3155760000000

It has converted P100Y to 3155763600000.
3,155,763,600 seconds;
52,596,060 minutes;
876,601 hours.

876,600 looks like 100 years in hours; there are 24 leap years in the next 100 years. (there were 25 leap years in the last 100 years)

So where is that extra hour from? There would be the same number of daylight saving days in either case.

Given this comparison is using the javax.xml.datatype.DatatypeFactory to do the conversion, it feels like the issue is there.

Regardless of the cause if the descrepency this PR allows the tests to pass.

@wheata03 wheata03 changed the title Replace P100Y with an hour equivilent. Replace P100Y with an hour equivalent. Apr 3, 2024
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.

1 participant