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

elgg_view input/date with timestamp on supports just one date format #7476

Closed
arimourao opened this Issue Nov 10, 2014 · 9 comments

Comments

Projects
None yet
3 participants
@arimourao

arimourao commented Nov 10, 2014

As it is now, input/date just support the format 'yy-mm-dd'. Would be nice if it could be parameterized to support other formats more popular in other countries, like the format 'dd-mm-yy'.

@hypeJunction

This comment has been minimized.

Contributor

hypeJunction commented Nov 10, 2014

+1. Both input and output views should be able to take a format string. The input view should add format and other useful data-attributes, which should then be picked up by datepicker.

@ewinslow

This comment has been minimized.

Member

ewinslow commented Nov 10, 2014

They should also just do the most logical thing for the current locale...

@arimourao

This comment has been minimized.

arimourao commented Nov 11, 2014

Maybe it is about time to elgg jump in into HTML5 specificiations, specially the "data-*" attributes. I will work on a fix to this, where "data-format-date" could be used as a parameter to the datepicker. If none, is passed, "yy-mm-dd" is assumed.
Formatting accordingly to locale would also be desirable, but more time consuming. The "data-format-date" would be a quick fix to this issue. What do you guys think?

@ewinslow

This comment has been minimized.

Member

ewinslow commented Nov 11, 2014

Wouldn't jumping into html5 specifications mean using <input type="date">

@hypeJunction

This comment has been minimized.

Contributor

hypeJunction commented Nov 11, 2014

Should also consider #492

@arimourao

This comment has been minimized.

arimourao commented Nov 16, 2014

Okay, I had the time to look the problem more closely. The problem with the datepicker is this snippet in the 'ui.js' file, in the initDatePicker function:

if (elgg.get_language() == 'en') {
loadDatePicker();
} else {
// load language first
elgg.get({
url: elgg.config.wwwroot + 'vendors/jquery/i18n/jquery.ui.datepicker-'+ elgg.get_language() +'.js',
dataType: "script",
cache: true,
success: loadDatePicker,
error: loadDatePicker // english language is already loaded.
});
}

elgg.get_language() outputs 'pt_br' when the site is configured with Brazilian Portuguese language. But the name of the jquery i18n file for configuring datepicker regional settings is 'jquery.ui.datepicker-pt-BR'. So, what is the best solution to this? Renaming i18n file to 'jquery.ui.datepicker-pt_br'?

@ewinslow

This comment has been minimized.

Member

ewinslow commented Nov 17, 2014

I think normalizing the language code that get_language returns so that it points to the right file would be a better approach.

@arimourao

This comment has been minimized.

arimourao commented Nov 18, 2014

yeah, but other parts of the application could be specting "pt_br" to be returned. I don't know why the i18n team just didn't stick with the convention.

@ewinslow

This comment has been minimized.

Member

ewinslow commented Nov 18, 2014

I meant something like this:

normalizeLocaleToJqueryUiFormat(elgg.get_language());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment