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

fix: handle tzinfo in HH format in local mode #537

Merged
merged 4 commits into from
Mar 13, 2024
Merged

Conversation

joein
Copy link
Member

@joein joein commented Mar 12, 2024

No description provided.

@joein joein requested a review from coszio March 12, 2024 21:44
Copy link

netlify bot commented Mar 12, 2024

Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit ef280a4
🔍 Latest deploy log https://app.netlify.com/sites/poetic-froyo-8baba7/deploys/65f1bbca6836aa000814370f
😎 Deploy Preview https://deploy-preview-537--poetic-froyo-8baba7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@joein
Copy link
Member Author

joein commented Mar 12, 2024

#511

Comment on lines 41 to 57
parsed_dt = parse_available_formats(date_str)
if parsed_dt is not None:
return parsed_dt

if "+" in date_str:
dt_str, tz_str = date_str.split("+")
tz_offset = int(tz_str.lower().replace("z", ""))
elif "-" in date_str[-4:]:
dt_str, tz_str = date_str.rsplit("-", 1)
tz_offset = -int(tz_str.lower().replace("z", ""))
else:
return None

parsed_dt = parse_available_formats(dt_str)
if parsed_dt is not None:
parsed_dt = parsed_dt.replace(tzinfo=timezone(timedelta(hours=tz_offset)))
return parsed_dt
Copy link
Member

Choose a reason for hiding this comment

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

This is not trivial part, requires more comments/examples

@joein joein requested a review from generall March 13, 2024 14:45
@joein joein merged commit 185121e into dev Mar 13, 2024
14 checks passed
joein added a commit that referenced this pull request Mar 27, 2024
* fix: handle tzinfo in HH format in local mode

* fix: fix mypy

* fix: replace dt split by trying adding minutes to tz (#540)

* refactoring: remove redundant import
@generall generall deleted the fix-dt-format-local-mode branch May 3, 2024 10:50
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

Successfully merging this pull request may close these issues.

2 participants