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

Let nextcord.utils.format_dt also take a timestamp instead of only datetime #1085

Closed
H4ckerxx44 opened this issue Jul 9, 2023 · 4 comments · Fixed by #1099
Closed

Let nextcord.utils.format_dt also take a timestamp instead of only datetime #1085

H4ckerxx44 opened this issue Jul 9, 2023 · 4 comments · Fixed by #1099
Labels
p: low Priority: low - not important to be worked on t: enhancement Type: enhancement - new feature or request

Comments

@H4ckerxx44
Copy link
Contributor

Summary

Let the format_dt function from nextcord.utils also be able to work with unix timestamps

What is the feature request for?

The core library

The Problem

I have to either manually format them or convert something to a python datetime object just for the sake of using the format_dt function

The Ideal Solution

Let nextcord.utils.format_dt(...) also take unix timestamps instead of only datetime objects, especially when the format_dt function just calls .timestamp() on the supplied datetime object anyways

The Current Solution

Manually formatting it when not converting it to a datetime object just to be able to use this function

Additional Context

No response

@H4ckerxx44 H4ckerxx44 changed the title Let nextcord.utils.format_dt also take a timestamp instead of a datetime Let nextcord.utils.format_dt also take a timestamp instead of only datetime Jul 9, 2023
@EmreTech EmreTech added t: enhancement Type: enhancement - new feature or request p: low Priority: low - not important to be worked on help wanted Anyone is free to help, the issue shouldn't be *too* hard. labels Jul 9, 2023
@spifory
Copy link
Collaborator

spifory commented Jul 9, 2023

The idea's cool, but wouldn't that be inconsistent with the name of the function? Since it's format_dt (format datetime)

@teaishealthy
Copy link
Collaborator

This should be it's own function which format_dt can then use. Something like format_ts or format_timestamp

@H4ckerxx44
Copy link
Contributor Author

Or, perhaps, create something like to_discord_timestamp(a, b) whereas b is a format specifier and a is either a datetime or int?

@ooliver1
Copy link
Member

format_dt already exists, and could use the new function. The new function would also be available to use for ints. I can't think of a situation where you would have a variable that's either a datetime or int which requires a function that takes multiple types.

@teaishealthy teaishealthy added the s: awaiting review Status: the issue or PR is awaiting reviews label Jul 26, 2023
@ooliver1 ooliver1 removed s: awaiting review Status: the issue or PR is awaiting reviews help wanted Anyone is free to help, the issue shouldn't be *too* hard. labels Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: low Priority: low - not important to be worked on t: enhancement Type: enhancement - new feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants