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

Make datetime available #9

Closed
ghost opened this issue May 17, 2021 · 1 comment
Closed

Make datetime available #9

ghost opened this issue May 17, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented May 17, 2021

hello, i'm not sure if this request belongs here or on avrae/avrae (or if feature requests are welcome :p ) but i would find it really helpful if datetime was made available to users of draconic

i have code like this in a custom command of mine; very much "smelly" and probably buggy as well:

days_of_the_week = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
num_days_in_week = len(days_of_the_week)

# the unix epoch is a thursday
epoch_starts_on = 3
now_timestamp = time()

seconds_per_day = 60 * 60 * 24
epoch_day = floor(now_timestamp / seconds_per_day)
epoch_day_of_the_week = ((epoch_day + epoch_starts_on) % len(days_of_the_week))

seconds_left_in_day = seconds_per_day - (now_timestamp % seconds_per_day)
minutes_left_in_day = floor((seconds_left_in_day / 60) % 60)
hours_left_in_day = floor((seconds_left_in_day / 60) / 60)
@zhudotexe
Copy link
Collaborator

Duplicate of avrae/avrae#1277 - the main concern here is auditing the types added by datetime

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

1 participant