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

Date arithmetic - Adding a Date and a number #127

Open
romaintailhurat opened this issue Oct 2, 2023 · 4 comments
Open

Date arithmetic - Adding a Date and a number #127

romaintailhurat opened this issue Oct 2, 2023 · 4 comments

Comments

@romaintailhurat
Copy link
Collaborator

Some date arithmetics are already implemented in Trevas JS.

In the case of subtraction between two dates, the return type is an integer (eg seconds).

We would like to implement addition and subtraction between a date and a number with another date as the return type.

For example, with a DATE variable of 2023-09-29, we would like the resulting behavior:

DATE + 32023-10-02

@romaintailhurat
Copy link
Collaborator Author

The VTL spec doesn't allow for this kind of behavior:

image

@romaintailhurat
Copy link
Collaborator Author

Maybe we could a custom operator that wraps a call to a underlying engine function? Or is it too much of a hack?

@NicoLaval
Copy link
Collaborator

Hi,

Instead of the 3 integer you certainly want to add a duration to the date, enable you to specify that your 3 is 3 days.
Didn't find a way to do it for now: Date + Duration -> Date

This subject can maybe be discussed this week during Roma meeting.

Please link your issue to the https://github.com/VTL-Community/VTL-Community issues.

@romaintailhurat
Copy link
Collaborator Author

👉 VTL-Community/VTL-Community#38

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