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

TimeDeltaLiteral accepts only positive numbers, while DateDeltaLiteral has no such restriction #645

Open
alamqadem opened this issue Feb 13, 2023 · 3 comments

Comments

@alamqadem
Copy link
Contributor

alamqadem commented Feb 13, 2023

TimeDeltaLiteral requires the value to be a positive integer (typeof_TimeDeltaLiteral).

image

DateDeltaLiteral doesn't require the value to be a positive integer (typeof_DateDeltaLiteral).

image

This is an inconsistency and it was found by a customer.

Could we remove the constraint on the positive value in TimeDeltaLiteral?

@arimer
Copy link
Member

arimer commented Feb 13, 2023

I think it would be important to explain why this is a problem in the first place. Could you maybe sketch a short example where you think this behaviour is wrong?

@alamqadem
Copy link
Contributor Author

This is an example of what I would like to do.
image

In the first case I can use the variable n for days, months and years, but I can't do the same for hours, minutes and seconds. This is because TimeDeltaLiteral requires its value to be positive.
I don't understand why we have the restriction only on TimeDeltaLiteral and what is the reason to be restricted to only positive values?

@heikob2
Copy link

heikob2 commented Jun 25, 2023

Hi, in my opinion also this restriction to "only positive values" makes no sense.

Shouldn't both typesystem-rules for DateDeltaLiteral and TimeDeltaLiteral look the same?

heikob2 added a commit that referenced this issue Jun 26, 2023
…allows also negative integers + updated test.
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

3 participants