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 date arithmetic #1

Closed
choptastic opened this issue Sep 1, 2013 · 1 comment
Closed

Add date arithmetic #1

choptastic opened this issue Sep 1, 2013 · 1 comment

Comments

@choptastic
Copy link
Owner

Add Single-line date-arithmetic and formatting. Perhaps just as a 3rd or 4th argument to the various conversion functions.

For example: qdate:to_string(Modifier, Format, TZ, Date) This seems messy, since qdate:to_string(Modifer, Format, Date) would be ambiguous with qdate:to_string(Format, TZ, Date).

Alternatively, it could be a simple qdate:math(Modifer, Date), which would return perhaps whatever the original format was (integer() -> integer(), datetime() -> datetime()), with the exception being string() -> datetime().

Modifier would be a proplist that gets evaluated in order:

[
   {day, 5},
   {hour, -1},
]

Add 5 days, then subtract an hour.

This could, given Daylight Saving Time, be different if the hour was first decremented, then he days were added.

Generally, Hours, Minutes, and Seconds will be added based on their conversion to seconds and added to the unixtime, whereas Dates, Months, and years will be added to the erlang date 3-tuple.

@choptastic
Copy link
Owner Author

Added in 0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant