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

Time offsets #18

Open
alexshadley opened this issue Apr 9, 2019 · 1 comment
Open

Time offsets #18

alexshadley opened this issue Apr 9, 2019 · 1 comment

Comments

@alexshadley
Copy link

It would be nice if there was some sort of API that could add some time unit to a Posix time, for instance to get the time 5 hours from some input Posix time. The advantage being that developers wouldn't need to convert Posix to milliseconds, add the time, and convert back to Posix. Additionally, developers wouldn't need to lookup the number of milliseconds in their desired time increment. I'm imagining something akin to

offsetSeconds : Int -> Posix -> Posix
offsetMinutes : Int -> Posix -> Posix
offsetHours : Int -> Posix -> Posix
offsetDays : Int -> Posix -> Posix

where int can be either positive or negative. Additionally, pipeline syntax could be used to produce combinations of time units, for instance:

addHourThirty : Posix -> Posix
addHourThirty t =
  t
    |> offsetHours 1
    |> offsetMinutes 30

If this is indeed a feature the community is interested in, I'd be happy to develop it (shouldn't be too difficult).

@Erudition
Copy link

I too would be interested in gauging the interest in this, as it's a feature of my upcoming SmartTime library (not ready yet).

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