mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-30 22:25:19 +00:00 
			
		
		
		
	[utils] strftime_or_none: Workaround Python bug on Windows
				
					
				
			CLoses #5185
This commit is contained in:
		| @@ -2574,7 +2574,9 @@ def strftime_or_none(timestamp, date_format, default=None): | ||||
|     datetime_object = None | ||||
|     try: | ||||
|         if isinstance(timestamp, (int, float)):  # unix timestamp | ||||
|             datetime_object = datetime.datetime.utcfromtimestamp(timestamp) | ||||
|             # Using naive datetime here can break timestamp() in Windows | ||||
|             # Ref: https://github.com/yt-dlp/yt-dlp/issues/5185, https://github.com/python/cpython/issues/94414 | ||||
|             datetime_object = datetime.datetime.fromtimestamp(timestamp, datetime.timezone.utc) | ||||
|         elif isinstance(timestamp, str):  # assume YYYYMMDD | ||||
|             datetime_object = datetime.datetime.strptime(timestamp, '%Y%m%d') | ||||
|         date_format = re.sub(  # Support %s on windows | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 pukkandan
					pukkandan