Skip to content

[core] Calculate date by strftime_or_none; fix seconds in datetime_round #11902

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

pzhlkj6612
Copy link
Collaborator

@pzhlkj6612 pzhlkj6612 commented Dec 25, 2024

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

We have already applied some patches for this bug:

Now it's time to get the K.O.!

Refs:

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

…_round`

- Negative datetime is not acceptable on Windows.
- Scale the timestamp up 1000000 times to calculate milliseconds.
Copy link
Member

@pukkandan pukkandan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pzhlkj6612 pzhlkj6612 added bug Bug that is not site-specific pending-fixes PR has had changes requested labels Dec 25, 2024
More readable. Since Python 3.6: https://docs.python.org/3/library/functions.html#int

Co-authored-by: pukkandan <pukkandan.ytdlp@gmail.com>
@pukkandan pukkandan removed the pending-fixes PR has had changes requested label Dec 25, 2024
@@ -1367,22 +1367,30 @@ def datetime_add_months(dt_, months):
return dt_.replace(year, month, day)


def datetime_from_timestamp(timestamp):
# Calling dt.datetime.fromtimestamp with negative timestamps throws error in Windows
# Ref: https://github.com/yt-dlp/yt-dlp/issues/5185, https://github.com/python/cpython/issues/94414,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Ref: https://github.com/yt-dlp/yt-dlp/issues/5185, https://github.com/python/cpython/issues/94414,
# Ref: https://github.com/yt-dlp/yt-dlp/issues/5185, https://github.com/python/cpython/issues/81708,

@bashonly bashonly moved this to Release blocker in Release Tasks Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is not site-specific
Projects
Status: Release blocker
Development

Successfully merging this pull request may close these issues.

3 participants