nhsconnect / gpconnect-provider-testing

GP Connect automated test suite for API providers
Apache License 2.0
11 stars 5 forks source link

DateTime conversion: MedicationStatement.DateAsserted #304

Open KevinMayfield opened 5 years ago

KevinMayfield commented 5 years ago

We are supplying DateAsserted as

"dateAsserted": "2019-09-10T10:42:08.425Z",

And acceptance test returns

Shouldly.ShouldAssertException : toCheck should be less than or equal to 2019-09-10T10:44:37.3810160Z but was 2019-09-10T11:44:36.8010000+01:00

KevinMayfield commented 5 years ago

This appears to be caused by the dateConversion in: AccesStructuredMedicationSteps line 538.

DateTime dateAsserted = DateTime.Parse(medStatement.DateAsserted);

This converts the correct time to BST (2019-09-10T11:44:36.8010000+01:00)

KevinMayfield commented 4 years ago

Will recheck on 1.2.4 (suspect not an issue due to current TZ)

PeterGresty commented 4 years ago

From my initial investigation, this appears to the fact that the code, is using utcNow which does not apply the offset for BST, and hence why there was one hour discrepancy...(test was run in BST) As we are now out of BST then, if that theory holds then the test would now pass for you.. Kevin , Can you re-run this test and report back, if it now passes ? Once you confirm the results, I could look at putting in a change that would stop that happening in the future. Thx

KevinMayfield commented 4 years ago

Confirm this is working fine now.

PeterGresty commented 4 years ago

Thanks for confirming, I will further investigate this and develop a fix should one be required.