-
Notifications
You must be signed in to change notification settings - Fork 336
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 future and past providers to datetime #775
Comments
@ceccoemi Any chance you can work on it? I'm about to publish a new version and this feature will be a great addition in the changelog. |
@lk-geimfari yes, I should be able to work on it. Give me 2/3 days |
@ceccoemi Great! Thank you very much! Feel free to ask your questions about the feature to @sobolevn. |
@sobolevn @lk-geimfari a couple of questions. What do you think about adding the My idea is to override the methods that accepts the argument |
Sounds like a plan! |
This issue has been automatically marked as stale because it has not had activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This was never implemented. I needed this today once again. |
Wait, don't we have the ability to generate such dates? |
Almost every |
not in an easy way, judging from the docs here: https://mimesis.name/master/api.html#datetime Faker has There are lots of business rules based on time. These things are 100% required. See how many of them exist here: https://faker.readthedocs.io/en/stable/providers/faker.providers.date_time.html |
Can't we just add an extra argument and implement something like this: dt = Datetime(moment='PAST')
dt = Datetime(moment='FUTURE') |
Yes, this looks good to me. I would suggest to add more, like: |
@sobolevn Hey! I'm planning on providing something similar: class Timeframe:
PAST_YEAR = 'PAST_YEAR'
PAST_MONTH = 'PAST_MONTH'
PAST_WEEK = 'PAST_WEEK'
PAST_DAY = 'PAST_DAY'
FUTURE_YEAR = 'FUTURE_YEAR'
FUTURE_MONTH = 'FUTURE_MONTH'
FUTURE_WEEK = 'FUTURE_WEEK'
FUTURE_DAY = 'FUTURE_DAY'
ANY = 'ANY'
# Note: There are only 9 method of "Datetime" to which this feature is applicable:
dt = Datetime(timeframe=Timeframe.PAST_YEAR)
dt.bulk_create_datetimes()
dt.week_date()
dt.year()
dt.date()
dt.formatted_date()
dt.time()
dt.datetime()
dt.formatted_datetime()
dt.timestamp() Depending on the I can implement this on the weekend if it suits your needs. However, this can break backward compatibility. |
I also propose to add: |
I would love to see the same feature from
Datetime
ported to bothFutureDatetime
andPastDatetime
providers.I hope that you will get the idea from the class names 🙂
The text was updated successfully, but these errors were encountered: