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

Closed
minichma opened this issue Jan 10, 2023 · 5 comments
Closed

PeriodSerializer not working with midnight DATE-TIME. #564

minichma opened this issue Jan 10, 2023 · 5 comments

Comments

@minichma
Copy link
Collaborator

minichma commented Jan 10, 2023

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.

Also see similar code in CalDateTime.cs and a related issue in #602.

@axunonb
Copy link
Collaborator

axunonb commented Oct 13, 2024

Please double-check the new version merged with #595

@axunonb axunonb closed this as completed Oct 13, 2024
@minichma
Copy link
Collaborator Author

@axunonb: Yes, the problem still exists.

@minichma
Copy link
Collaborator Author

@axunonb I think we should reopen this. Don't think I can do that myself. Started working on a PR but could take a while until I find enough time, as all these little issues are interconnected.

@minichma minichma reopened this Oct 15, 2024
@minichma
Copy link
Collaborator Author

@axunonb Thanks for the invitation! Reopened the relevant issues.

@minichma
Copy link
Collaborator Author

minichma commented Dec 7, 2024

Fixed with #638

@minichma minichma closed this as completed Dec 7, 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

No branches or pull requests

2 participants