myusuf3 / delorean

Delorean: Time Travel Made Easy
http://delorean.rtfd.org/
MIT License
1.84k stars 128 forks source link

Feature Request: Adding a `replace` method to replace parts on the underlying `datetime` object #80

Open masnun opened 8 years ago

masnun commented 8 years ago

I was wondering if we could have a feature where we could replace the parts of the underlying datetime object. For example, I would really love to do this:

d = Delorean(timezone="US/Eastern")
d = d.replace(hour=8, minute=10)

I am currently achieving this by doing this:

d = Delorean(timezone="US/Eastern")
dt = d.datetime.replace(hour=12)
d = Delorean(dt)

But the above would be much easier. I can send a PR if this seems like a good idea.

myusuf3 commented 8 years ago

yeah if you wouldn't mind providing PR and test I would definitely be interested in merging this in.