jQWidgets Forums
jQuery UI Widgets › Forums › Editors › DateTimeInput › jqxDateTimeInput, culture and formatString issue
This topic contains 15 replies, has 2 voices, and was last updated by Peter Stoev 9 years, 11 months ago.
-
Author
-
Hello jqWidgets Team,
I started to use the jqxDateTimeInput widget and found a problem.
The jqxDateTimeInput has 2 properties : culture and formatString.
I am using the german culture (‘de-DE’) and the ‘dd/MM/yyyy’ formatString.
The formatString is not applied. Instead the ‘dd.MM.yyyy’ is applied.
It seem that the ‘globalize.culture.de-DE.js’ has a default pattern for ‘d’: ‘dd.MM.yyyy’ and this is used by default.
If I do not specify the culture, then the format pattern is applied as expected.
Is it possible to set the language for the datepicker in any other way?Can you please provide a solution for the problem?
Regards,
IoanaHere the fiddle: https://jsfiddle.net/ioana_v/wo5rnur7/1/
Hi ioana,
The formatString works perfectly well. The issue here is that you may not have looked at Your German Localization file where you will see that “/” is Localized to “.”
/* * Globalize Culture de-DE * * http://github.com/jquery/globalize * * Copyright Software Freedom Conservancy, Inc. * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * This file was generated by the Globalize Culture Generator * Translation: bugs found in this file need to be fixed in the generator */ (function( window, undefined ) { var Globalize; if ( typeof require !== "undefined" && typeof exports !== "undefined" && typeof module !== "undefined" ) { // Assume CommonJS Globalize = require( "globalize" ); } else { // Global variable Globalize = window.Globalize; } Globalize.addCultureInfo( "de-DE", "default", { name: "de-DE", englishName: "German (Germany)", nativeName: "Deutsch (Deutschland)", language: "de", numberFormat: { ",": ".", ".": ",", "NaN": "n. def.", negativeInfinity: "-unendlich", positiveInfinity: "+unendlich", percent: { pattern: ["-n%","n%"], ",": ".", ".": "," }, currency: { pattern: ["-n $","n $"], ",": ".", ".": ",", symbol: "€" } }, calendars: { standard: { "/": ".", firstDay: 1, days: { names: ["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"], namesAbbr: ["So","Mo","Di","Mi","Do","Fr","Sa"], namesShort: ["So","Mo","Di","Mi","Do","Fr","Sa"] }, months: { names: ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""], namesAbbr: ["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""] }, AM: null, PM: null, eras: [{"name":"n. Chr.","start":null,"offset":0}], patterns: { d: "dd.MM.yyyy", D: "dddd, d. MMMM yyyy", t: "HH:mm", T: "HH:mm:ss", f: "dddd, d. MMMM yyyy HH:mm", F: "dddd, d. MMMM yyyy HH:mm:ss", M: "dd MMMM", Y: "MMMM yyyy" } } } }); }( this ));
This means that the widget’s behavior is correct and your statement about an issue is invalid.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Thank you for the quick answer.
Actually I did look at the file.
I need the german culture so that in the datepicker I get the correct i18N names for months and days.
Yet, the date format pattern can be changed by the user, and one of this format patterns can be the specified one, which is not supported by the culture.
Which is why I asked if it is possible to set the language for the datepicker in any other way?Regards,
IoanaHi Ioana,
The language of jqxDateTimeInput should be set in the way demonstrated in its Localization demo. If you don’t like the Localization file, you may edit it in the way you find well for your app.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
My scenario is a bit more complicated. After the Grid is rendered, the user can change the date format for the entire application.
It means at that moment the localization file should be changed (this is your suggestion if I understood right). This is of course not practical. Instead it would be great to set the properties for the jqxDateTimeInput. Like: formatPattern, localization (not culture).Regards,
IoanaHi Ioana,
The Localization of this widget works with Localization file by design.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
I figured out you will say this :). This is a limitation from my point of view, and it is not specified (or it is unclear) in the documentation that the only supported formatString is one of the patterns from the Globalize file used (or specified in the culture).
Regards,
IoanaHi Ioana,
Thank you for your point. We don’t think that this is limitation. Localization files are for localizing content. When in the file “/” is set to “.”, the widget is supposed to take that fact into account.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
:(, too bad you think this is not a limitation, cause the widget is quite cool otherwise.
Except the fact that it has no support for format patterns like MMM d, ”yy .Regards,
IoanaHi Ioana,
MMM d works perfectly well: http://jsfiddle.net/r8yk185n/. The year should be ‘yyyy’.
Regards,
Peter stoevHi Peter,
I did not mean that the format MMM d does not work, but the MMM d, ”yy. It is not the same format.
regards,
IoanaHi ioana,
Your fiddle External resources links are invalid and so nothing is shown there.
Regards,
Peter stoevO, I apologize. This should be ok: https://jsfiddle.net/ioana_v/2ms4f6u4/3/
Regards,
Ioana -
AuthorPosts
You must be logged in to reply to this topic.