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

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

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

Comments

@arimourao
Copy link

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
Copy link
Contributor

+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
Copy link
Contributor

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

@arimourao
Copy link
Author

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
Copy link
Contributor

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

@hypeJunction
Copy link
Contributor

Should also consider #492

@arimourao
Copy link
Author

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
Copy link
Contributor

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

@arimourao
Copy link
Author

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
Copy link
Contributor

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
Labels
None yet
Development

No branches or pull requests

3 participants