MVC 5 - can not get globalisation running


I want to add globalization because the site asks the user for a date. And my german user want to type "31.12.1966" and not "1966-12-31".

So I add the nuget-Packages "jQuery.Validation.Globalize" and "jquery-globalize" to the project.

Now I am not able to configure my BundleConfig! From my research I know, that I Need globalize.js and some other files. So I try to make a b√ľndle:

 bundles.Add(new ScriptBundle("~/bundles/jquery").Include(

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(

        bundles.Add(new ScriptBundle("~/bundles/global").Include(

The using in the view:

@section Scripts {


<script type="text/javascript">

    $(function () {
        $ = function (value, element) {
            // you can alternatively pass the culture to parseDate instead of
            // setting the culture above, like so:
            // parseDate(value, null, "en-AU")
            return this.optional(element) || Globalize.parseDate(value) !== null;

But I get an error:

Error at line 9, column 5 in http://localhost:58289/Scripts/jquery.validate.globalize.js
0x800a138f - runtimeerror in JavaScript: 
The property "methods" of a undefindes or null-pointer can not bei called

I translated the message from this german original:

Ausnahmefehler in Zeile 9, Spalte 5 in http://localhost:58289/Scripts/jquery.validate.globalize.js
0x800a138f - Laufzeitfehler in JavaScript: 
Die Eigenschaft "methods" eines undefinierten oder Nullverweises kann nicht abgerufen werden.

Need I more/other files in the bundle?

What can I do? Any help?

Sincerly Peter

asked on Stack Overflow Jun 26, 2017 by PBum • edited Jul 4, 2017 by PBum

1 Answer


I solved it this way:

In my view is the following script block:

<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>

<script src="~/Scripts/cldr.js"></script>
<script src="~/Scripts/cldr/event.js"></script>
<script src="~/Scripts/cldr/supplemental.js"></script>
<script src="~/Scripts/cldr/unresolved.js"></script>

<script src="~/Scripts/globalize.js"></script>
<script src="~/Scripts/globalize/currency.js"></script>
<script src="~/Scripts/globalize/number.js"></script>
<script src="~/Scripts/globalize/date.js"></script>
<script src="~/Scripts/globalize/plural.js"></script>
<script src="~/Scripts/globalize/relative-time.js"></script>
<script src="~/Scripts/globalize/unit.js"></script>
<script src="~/Scripts/jquery.validate.globalize.js"></script>

    $(document).ready(function () {
        // Use $.getJSON instead of $.get if your server is not configured to return the
        // right MIME type for .json files.
        ).then(function () {
            // Normalize $.get results, we only need the JSON, not the request statuses.
            return [].slice.apply(arguments, [0]).map(function (result) {
                return result[0];
    .then(function () {

My data-class has an annotiation like this:

    [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd.MM.yyyy}")]
    public DateTime Geburtsdatum { get; set; }

And - very important!! - you must get the data-files! This is nessecary because the clrd-data is not part of the NuGet-Packages "jQuery.Validation.Globalize" / "jquery-globalize". (Yes, it is mentioned on the Project-page - but I didn't see it... :-( )

I installed Bower (per NuGet) and installed then via Bower the Cldr-data. Example:

 bower install cldr-dates-full

(see overview over packages and install instruction 1)

Then I moved the needed json-files (here you find an online-tool for file-selection 2) from Directory "bower_components" to "scripts\cldr\main\de" respectively "scripts\cldr\supplemental".

I add them to the project and mark them as "Content", "no copy".

So finally it works!!! :-)

If I manage it to bundle the js- and json-files, I will update the answer.

answered on Stack Overflow Jul 4, 2017 by PBum

User contributions licensed under CC BY-SA 3.0