﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20006	Converting a datestring into a proper date from and AJAX call	erik@…	nobody	"When an AJAX call passes a date in a Django L10N/I18N site, the date will be a string, formatted according to the current users locale.[[BR]]

This means that on the server, Django needs to convert this string into a proper date, taking the locale of the user into account. I can't find a way to do so.[[BR]]
The only lead I have found was to use Python's time.strptime() function, and use Django's  django.utils.formats.get_format() function to pass it the correct format. However, Django's get_format() function returns ""j-n-Y"" for me (user with Dutch locale), which is not a valid format for the strptime() function.[[BR]]

USE_L10N is True, and USE_I18N is also True.


{{{
def StringToDate(datestring):
    from django.utils.formats import get_format
    from time import strptime
    short_datetime_format = get_format(""SHORT_DATE_FORMAT"")
    return strptime(datestring, short_datetime_format)
}}}
[[BR]]

ValueError: time data u'08-03-2013' does not match format 'j-n-Y'"	Bug	closed	Internationalization	1.5	Normal	worksforme	get_format L10N		Unreviewed	0	0	0	0	0	0
