Skip to content

datetime not actually supported #2

@KormiSK

Description

@KormiSK

Despite being the only example in the documentation, datetime is not actually supported

>>> discord_timestamps.format_timestamp(datetime.datetime(2021, 11, 20, 12, 0, 0))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kormi/micromamba/envs/k/lib/python3.11/site-packages/discord_timestamps/__init__.py", line 40, in format_timestamp
    return f"<t:{int_timestamp}{timestamp_type.value}>"
                 ^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'int_timestamp' where it is not associated with a value

Idk what that one pull request in here is about, it mentions datetime but I don't understand its content, but this is still not supported. Would be nice to either a) delete it from the documentation, or b) make it work. If date is in datetime form, none of the ifs validate and thus int_timestamp is not assigned, thus cannot be printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions