Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PeriodSerializer not working with midnight DATE-TIME. #564

Open
minichma opened this issue Jan 10, 2023 · 0 comments
Open

PeriodSerializer not working with midnight DATE-TIME. #564

minichma opened this issue Jan 10, 2023 · 0 comments

Comments

@minichma
Copy link

PeriodSerializer doesn't deserialize a period's duration correctly if the start IDateTime's time is set to midnight.

E.g. the following period string should be serialized to a period with a duration of 6H but actually has 1D:
20180219T000000Z/PT6H

Can be reproduced via the following test case:

[Test]
public void TestPeriods()
{
    var serializer = new PeriodSerializer();
    var res = serializer.Deserialize(new System.IO.StringReader("20180219T000000Z/PT6H")) as Period;

    Assert.AreEqual(6.0, res.Duration.Hours);
    Assert.IsTrue(res.StartTime.HasTime);
 }

The problem boils down to Period automatically assuming a duration of 1D if the time component is zero.

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

No branches or pull requests

1 participant