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

Fix broken tests in Datetime Parser #10645

Closed
wants to merge 2 commits into from
Closed

Conversation

hishamco
Copy link
Member

@hishamco hishamco commented Nov 5, 2021

Related to #10601

@@ -67,22 +67,6 @@ public override string ToString()
=> $"{(String.IsNullOrEmpty(Operator) ? String.Empty : Operator)}{DateTime.ToString("o")}";
}

public class DateNode2 : OperatorNode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have to understand why I added this, it was for a reason. So I disagree with removing it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I disagree with removing it.

Take your time to check this, I notice that the DateNode that you added is based on DateTime which makes issues with offset, now I need to asked you what are the reasons for adding this ;)

Copy link
Contributor

@Skrypt Skrypt Nov 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method implies that the datetime is passed as a UtcDateTime. Just add comments on the method. And you could also add an if on the constructor to verify that the datetime is of UtcKind.

Copy link
Member Author

@hishamco hishamco Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Skrypt could you please elaborate?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm saying is that if DateNode2 uses a DateTime as a parameter and that this DateTime should always be as UTC then you can also validate it inside the DateTime2 constructor instead to keep what we had. If we remove DateNode2 then we need to keep it and mark it as Obsolete instead. But, I assume here that this is used only by the AuditTrail so the changes you made are fine. So, up to @deanmarcussen to illustrate his point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still waiting for @deanmarcussen to clarify why DateTime2 is here, it's fine to mark it as obsolete for now

@hishamco
Copy link
Member Author

hishamco commented Sep 6, 2022

@Skrypt can we revise this PR while Dean is absent for awhile. @Piedone your though while Lombiq in charge of creating this module

@Piedone
Copy link
Member

Piedone commented Sep 6, 2022

I checked this out but really have nothing to add.

@Skrypt
Copy link
Contributor

Skrypt commented Sep 7, 2022

You will need to explain to me what this piece of code does because I have no idea as of now. I would need to analyze the Audit Trail module to understand it better. But here, we have 2 classes that have either a DatetimeOffset or a Datetime as a parameter to differentiate them. Normally, you should use a different constructor on the same class for that matter. But at the same time, the information that no one gave me is about if it is necessary to have a UTC DateTime here. Because then, the class that has a DateTime parameter would need to make sure that the DateTime passed is of UtcKind.

https://docs.microsoft.com/en-us/dotnet/api/system.datetimekind?view=net-6.0

Then, why there are 2 different classes for doing this is what needs to be defined before anything else.

@hishamco
Copy link
Member Author

hishamco commented Sep 7, 2022

Then, why there are 2 different classes for doing this is what needs to be defined before anything else.

That's why I waiting for the Dean from awhile, please check his comment here

@deanmarcussen
Copy link
Member

Then, why there are 2 different classes for doing this is what needs to be defined before anything else.

That's why I waiting for the Dean from awhile, please check his comment here

I made it quite clear this was not a good pr. Please do not remove the second date class, it is there for a reason.

@hishamco
Copy link
Member Author

hishamco commented Sep 7, 2022

I'm stilll waiting for that reason ;) we could check where is it used or fix uncommented tests in the way you prefer

@Skrypt
Copy link
Contributor

Skrypt commented Sep 8, 2022

Unless it is an issue for someone "which I would really be surprised" then I suggest we leave it as it is for now and come back later if it becomes a need. Else, we are just optimizing code for optimizing it while potentially breaking implementations.

@Piedone
Copy link
Member

Piedone commented Jan 28, 2024

You can rename DateNode to DateTimeOffsetNode and DateNode2 to e.g. DateTimeNode if you're really inclined to, but that's about what I think would be useful here, apart from fixing the test.

Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@Piedone
Copy link
Member

Piedone commented Feb 11, 2024

Superseded by #15297.

@Piedone Piedone closed this Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants