iets3.opensource icon indicating copy to clipboard operation
iets3.opensource copied to clipboard

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

Open alamqadem opened this issue 3 years ago • 3 comments

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?

alamqadem avatar Feb 13 '23 15:02 alamqadem

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?

arimer avatar Feb 13 '23 19:02 arimer

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?

alamqadem avatar Feb 14 '23 14:02 alamqadem

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 avatar Jun 25 '23 10:06 heikob2