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

Timezone without format #62

Open
djcoin opened this issue Jan 29, 2015 · 5 comments
Open

Timezone without format #62

djcoin opened this issue Jan 29, 2015 · 5 comments

Comments

@djcoin
Copy link

djcoin commented Jan 29, 2015

Is it possible to use L10N and yet to specify a custom format?
It does not seem so at the time ( https://github.com/asaglimbeni/django-datetime-widget/blob/master/datetimewidget/widgets.py#L193 ).

Would you accept a simple patch that enables this?

@komackaj
Copy link
Contributor

Hi,

I've managed to solve this via Django localization https://docs.djangoproject.com/en/1.7/topics/i18n/formatting/ by overriding DATETIME_INPUT_FORMATS. With this solution you will benefit from automatic conversions to Django datetime objects when processing forms POST data with this widget in the form. I'm not sure if it would work with your approach.

@ollytheninja
Copy link

So I have nothing to do with maintaining this but I think it would be a pretty good idea!
:shipit:

@michaeljones
Copy link
Contributor

I think the idea is that if you enable L10N, then you should work with the Django DATETIME_INPUT_FORMATS to get the appropriate localised formats.

I've not used this in a bit, but what would be the advantage of having L10N on and then setting the format anyway? I thought the L10N was just about helping with formatting?

@ollytheninja
Copy link

I think #68 is related? Format not working when L10N is enabled?
While I can understand the logic behind the way it's implemented, wouldn't it be better to still allow specifying a custom format if you're using L10n?

@JaHicks
Copy link

JaHicks commented Feb 12, 2016

I have committed a quick pull request which resolves this issue - #93 . It seems that translations do not take effect unless usel10n is set, but there may be cases where translations are required and a specific format is also needed.

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

No branches or pull requests

5 participants