-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
range and span_range with interval size #362
Comments
Can you give us a code example? |
Here's an example of how I ended up implementing the code for my own use. Uses funcy. Also I ended up returning a dictionary instead of a list of tuples but that can be easily changed.
The idea is for me to be able to do something like this:
|
Got it appreciate the example. I wonder if it would be more expressive to use a new method called "interval" for this purpose. |
Having a new method called interval sounds fine. Could probably use arrow.range and arrow.span_range underneath like the example. |
Exactly. No need to duplicate code.
…On Thu, Dec 1, 2016 at 1:09 PM rhan-mentad ***@***.***> wrote:
Having a new method called interval sounds fine. Could probably use
arrow.range and arrow.span_range underneath like the example.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#362 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AG69mQ-n3cnEm3BM_javsLsL0QpHz9MYks5rDzdugaJpZM4KUNB3>
.
|
Done in #386 so closing. |
It seems |
@dongli something like this? (arrow) chris@ThinkPad:~/arrow$ python
Python 3.7.4 (default, Sep 19 2019, 11:01:37)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import arrow
>>> right_now=arrow.utcnow()
>>> five_hours_ago=right_now.shift(hours=-5)
>>> right_now
<Arrow [2020-03-06T20:12:27.474979+00:00]>
>>> five_hours_ago
<Arrow [2020-03-06T15:12:27.474979+00:00]>
>>> list(arrow.Arrow.range("minute", five_hours_ago, right_now, limit=1))
[<Arrow [2020-03-06T15:12:27.474979+00:00]>] |
It would be good to have a parameter for interval size for arrow.Arrow.range and arrow.Arrow.span_range.
Eg I want a range across 5 days between some start and end date, or 2 weeks, etc.
The text was updated successfully, but these errors were encountered: