Skip to content

First argument of localdate() and localtime() should be Optional #104

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

Closed
nuschk opened this issue Jul 10, 2019 · 2 comments · Fixed by #105
Closed

First argument of localdate() and localtime() should be Optional #104

nuschk opened this issue Jul 10, 2019 · 2 comments · Fixed by #105
Labels
bug Something isn't working

Comments

@nuschk
Copy link

nuschk commented Jul 10, 2019

In timezone.pyi, instead of

def localtime(value: _AnyTime, timezone: Optional[tzinfo] = None) -> datetime: ...
def localdate(value: _AnyTime, timezone: Optional[tzinfo] = None) -> date: ...

these should quite simply be:

def localtime(value: Optional[_AnyTime] = None, timezone: Optional[tzinfo] = None) -> datetime: ...
def localdate(value: Optional[_AnyTime] = None, timezone: Optional[tzinfo] = None) -> date: ...

This is true for django >= 1.11, so well within the scope of django-stubs.

Oh, and thank you so much for this great package! <3

@sobolevn
Copy link
Member

Yes, I confirm that this is true: https://github.com/django/django/blob/master/django/utils/timezone.py#L191-L211

@sobolevn sobolevn added the bug Something isn't working label Jul 10, 2019
sobolevn added a commit that referenced this issue Jul 10, 2019
mkurnikov pushed a commit that referenced this issue Jul 10, 2019
* Makes localtime/localdate accept optional params

Closes #104

* Removed None from default values
@nuschk
Copy link
Author

nuschk commented Jul 11, 2019

Thanks!

voidus pushed a commit to voidus/django-stubs that referenced this issue Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants