devdecision wrote:Sorry, it was a grammar error.
I would like to know, if someone find a solution for this problem?
I don't think there is an official solution to this issue but I have also managed to fix the US date issue on my UK site by following bubbi's post on page 3. But somehow it worked for me without following all the steps or not following the steps exactly as they were.
I am very new to MVC and cannot figure out why and how it worked without following all the steps as they are but here is what I did;
Step 1 - at the bottom of _AdminLayout.cshtml page;
change
@(Html.Telerik().ScriptRegistrar()
.jQuery(false)
.jQueryValidation(false)
)
to
@(Html.Telerik().ScriptRegistrar()
.jQuery(false)
.jQueryValidation(false)
.Globalization(true)
)
NOTE: My issue was about the date not the decimal sign so I have ignored the step 2 on bubie's post
Step 2 - changes on global.asax file;
As I am using version 3.1, there is only one line of code on my "global.asax" so I had to go to source file (Global.asax.cs) file and make the following change, again towards the bottom of the page/code
change
var culture = new CultureInfo("en-US");
to
var culture = new CultureInfo("en-GB");
Just these two steps was good enough to display the dates in dd/mm/yyy format on IE and I had no issues with the decimal prices . However on Google chrome I also experienced an issue with the date picker so I applied the fix on the following page;
http://www.codeproject.com/Tips/579279/Fixing-jQuery-non-US-Date-Validation-for-Chrome
Step 3 - add the script to _AdminLayout.cshtml head tag
I have simply added the following code just before my </head> tag;
<script>
// fix date validation for chrome
jQuery.extend(jQuery.validator.methods, {
date: function (value, element) {
var isChrome = window.chrome;
// make correction for chrome
if (isChrome) {
var d = new Date();
return this.optional(element) ||
!/Invalid|NaN/.test(new Date(d.toLocaleDateString(value)));
}
// leave default behavior
else {
return this.optional(element) ||
!/Invalid|NaN/.test(new Date(value));
}
}
});
</script>
And that is it. It all worked for me. I am not sure if I ended up breaking something else but a few tests and page views with changes to prices, dates, kg, mm and similar all proved to working so far.