3

I am trying to install Globalize to resolve an issue I desribe here: Validation failing because of date format. Please see Christopher Thrower answer.

How do I add globalize.js and jquery.val.globalize.js to bundles/jqueryval?

bundles/jqueryval currently looks like this:

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));

The path to the two files is:

c:\application\packages\jquery-globalize.1.0.0\content\Scripts\globalize.js
c:\application\packages\jquery-globalize.1.0.0\content\Scripts\jquery.validate

The path to the MVC scripts folder is:

c:\application\mvc\scripts

Also what is meant by: ~/ in the path. I can find no documentation.

Balagurunathan Marimuthu
  • 2,927
  • 4
  • 31
  • 44
w0051977
  • 15,099
  • 32
  • 152
  • 329
  • `~/` gets translated to the root of the web application, so in this case `~/scripts` means `c:\application\mvc\scripts` for example. – DavidG Jul 19 '17 at 08:54
  • @DavidG, how do I get to: globalize.js ? – w0051977 Jul 19 '17 at 08:55
  • If the Nuget package hasn't copied the js file into your web project folder, then you will need to do this manually. Also, perhaps send a message to the project maintainer about it – DavidG Jul 19 '17 at 08:58
  • @DavidG, do you know how to setup this Globalize package? I am pulling my hair out. The documentation is very comprehensive but explains nothing in my opinion. – w0051977 Jul 19 '17 at 09:13
  • I have no idea, never used that package (and you haven't linked to it so I can't even take a look!) – DavidG Jul 19 '17 at 09:18
  • @DavidG, it is here: https://github.com/globalizejs/globalize – w0051977 Jul 19 '17 at 09:23

1 Answers1

1

Having taken a look at the package I can see that it installs the relevant Javascript files directly into your web project. So if you take a look you will see something like this:

Project Layout

So to add it to your app, it should be as simple as

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
    "~/Scripts/jquery.validate*",
    "~/Scripts/globalize.js"));
DavidG
  • 113,891
  • 12
  • 217
  • 223
  • I have done that. However, it appears to do nothing. Absolutely nothing. – w0051977 Jul 19 '17 at 09:55
  • What do you expect it to do? – DavidG Jul 19 '17 at 09:59
  • Please see my other question here: https://stackoverflow.com/questions/45169314/validation-failing-because-of-date-format – w0051977 Jul 19 '17 at 10:03
  • 1
    No, I'm not going to do that. The question needs to be self contained. You asked how to add the js files to your bundle and I answered that. How you use the library is now up to you. – DavidG Jul 19 '17 at 10:04