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

Add duration literal support #499

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fmarcia
Copy link

@fmarcia fmarcia commented Dec 13, 2023

This pull request adds support for duration literal:

-1h == -1 * 1h
+1h == 1h
2 * 1h == 2h
1h + 1m == 1h1m
1h - 1m == 59m
1h / 10m == 6
1h / 2 == 30m

round, max, min and abs builtin functions have been updated to support duration as well.

@antonmedv
Copy link
Member

I'm not sure yet if this should be added directly to the language itself. We already have duration() func.

Why do you think this should be implemented directly in the language?

@fmarcia
Copy link
Author

fmarcia commented Dec 18, 2023

Mostly for the sake of readability. I'm using durations frequently, and I find literal format more readable and quicker to type as well.

@antonmedv antonmedv removed the feature label Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants