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

Allow replacing the weekday too. #64

Closed
kaste opened this issue Oct 22, 2013 · 3 comments
Closed

Allow replacing the weekday too. #64

kaste opened this issue Oct 22, 2013 · 3 comments

Comments

@kaste
Copy link

kaste commented Oct 22, 2013

dateutil.relativedelta allows searching for the next monday or previous tuesday, and so on:

from dateutil.relativedelta import relativedelta, MO
n = arrow.utcnow()
n
>>> <Arrow [2013-10-22T10:19:37.595000+00:00]>
n + relativedelta(weekday=MO(+1))
>>> <Arrow [2013-10-28T10:19:37.595000+00:00]>
n + relativedelta(weekday=MO(-1))
>>> <Arrow [2013-10-21T10:19:37.595000+00:00]>

Actually, no need to cut the features of the dateutil you're using anyway.

Opinions?

@crsmithdev
Copy link
Collaborator

I like the idea, except I would want to avoid having to import special symbols (MO, etc.) to make this work. Let me see if I can come up with a nice way of implementing this without.

@thedrow
Copy link

thedrow commented Nov 12, 2013

Delorean just has methods like d.next_monday()

@dingus9
Copy link

dingus9 commented Oct 2, 2014

dateutil.relativedelta will replace weekday=0-6 with the correct weekday() instance. I'm thinking all you need to do to get the basic functionality working is add weekday to self._ATTRS_PLURAL in arrow.py.

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

4 participants