jQuery Date Validation in Chrome

jQuery Date Validation in Chrome

[Source: http://geekswithblogs.net/EltonStoneman]

We had a fiddly issue with date validation in an ASP.NET MVC page failing for a valid date in Chrome, but passing in Firefox, IE etc. Tracing through our own code and xVal, the issue was narrowed down to the jQuery validation plugin (jquery.validate.js). For simple date validation, the library instantiates a date object from the given text value and lets JavaScript raise errors for invalid dates:

date: function(value, element) {

return this.optional(element) || !/Invalid|NaN/.test(new Date(value));


Chrome seems to ignore the current locale when it creates the date object, so a valid date in UK dd/mm/yy format – 29/10/2009 – fails as Chrome seems to interpret it in US mm/dd/yy format. Easy to test outside of all other code by entering some simple JavaScript into the address bar:

javascript:new Date(’29/10/2009′).toString()

Which Firefox renders as expected:

– as does IE (even IE6):

– but which Chrome renders as an invalid date:

You can also test it by navigating to the jQuery date validation sample page, and checking results for the same date in different browsers.

The fix is a simple change to the jQuery script to force the use of the current locale:

// http://docs.jquery.com/Plugins/Validation/Methods/date

date: function(value, element) {

//ES – Chrome does not use the locale when new Date objects instantiated:

//return this.optional(element) || !/Invalid|NaN/.test(new Date(value));

var d = new Date();

return this.optional(element) || !/Invalid|NaN/.test(new Date(d.toLocaleDateString(value)));


My presentations at HDC 09

My presentations at HDC 09

A little late on this post, but my excuse is that I’ve been traveling pretty much since I left HDC.  I had a great time at the show this year as Pluralsight was able to have a significant presence with our marketing team (Meagon) and three speakers (myself, Kent, and Aaron).  I wish I was the one leaving with that ZuneHD, but I’m pretty sure the lucky winner is enjoying it.  Hopefully folks who attended have checked out there free week of Pluralsight On-Demand so they can see what we are doing with our online training – customers are telling me they really love being able to go online anytime and watch a knowledgeable instructor walk them through some content. 

The show was well organized and had a lot of cool social and networking opportunities.  I’m really glad we have a show like this in the midwest, and hope we can build on the HDC model to have more in the years to come. 

Here are the materials from my two talks at HDC. I’ve included a Beta 2 update for the WF4 sample code since Beta 2 shipped just days after the conference.  Hopefully that will make the transition easier for those of you who attended.


Add Reference Dialog Improvements (VS 2010 and .NET 4.0 Series)

Add Reference Dialog Improvements (VS 2010 and .NET 4.0 Series)

[In addition to blogging, I am now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu (@scottgu is my twitter name)]

This is the twelfth in a series of blog posts I’m doing on the upcoming VS 2010 and .NET 4 release.  Today’s post covers a small, but nice, change coming with VS 2010 – an “Add Reference” dialog that loads fast.

Add Reference Dialog in VS 2008

The slow performance of the “Add Reference” dialog in previous releases of Visual Studio has been a common complaint that many a developer (including yours truly) has ranted about.

Previous releases of VS opened the “Add Reference” dialog on the “.NET” tab by default – and when that tab was loaded VS would synchronously scan the global assembly cache (GAC) retrieving .NET assembly information.  Because the GAC scan was done on the UI thread, it would freeze the IDE until the scan completed – which meant that you couldn’t cancel the operation, even if you didn’t want to use that tab. 

Because GAC scans can often take awhile (if you have lots of assemblies installed and/or a slow hard drive), you could end up having to wait a really long time for the dialog to respond.

Add Reference Dialog in VS 2010

The Beta2 release of VS 2010 introduces a few welcome changes to the “Add Reference” dialog behavior that significantly improves its performance. 

The first improvement is that the “Add Reference” dialog in VS 2010 now defaults to opening on the “Projects” tab instead of the .NET tab.  This means that the dialog always loads really fast.  If you want to setup a project-to-project reference, or browse the file-system to select a file assembly, etc. you can now select these tabs immediately without having to wait for anything to load.


The second improvement is that the .NET and COM tabs now load asynchronously and do not block the UI thread while their lists are populated.  This means that if you accidentally click the tabs you are no longer blocked waiting for them to synchronously load – with VS 2010 you can now either click “Cancel” to close the dialog or click on another tab instead.


Hope this helps,


Got a Great BizTalk Tip or Trick and You Could Win Richard Seroter’s SOA Patterns Book

Thanks to Packt Publishing, I am pleased to offer you the opportunity to win a copy of Richard Seroter’s book SOA Patterns with BizTalk Server 2009 – a $60 value.  I will even cover the shipping costs, via book mail, to any place in the world the US Postal Service will deliver to. 

Here is what you need to do in order to win:

Simply let us know of a great BizTalk Tip or Trick using BizTalk 2006, BizTalk 2006 R2, or BizTalk 2009.  Tell us a little about it and why it is useful.  This could be as simple as a UI tip or complex as you want to make it.  This does not need to be anything new, you might have already blogged about it or posted it to a forum.  If so, that’s ok!

How to Enter:

1. Either post a comment to this blog post with your idea or post a link to your blog / post outlining your tip or trick.

To post a comment or link I suggest being a registered member of BizTalkGurus.com.  This will make it easier to find you if you win and easier to get past the SPAM filter.  In any case, your comment might not show up on the site right away.

2. Having problems posting a comment?  Then just email your idea or link directly to me using the Contact link on the side of my blog.

3. All entries must be received by Thursday November 5th, 2009 at 11:59 PM Central Time. 

4. The winner will be selected by Sunday November 8th and notified via email.  In addition, a blog post will be made to announce the winner the following day.

5.  All decisions of the judges are final. :) 

I will be working with a few other BizTalk MVP’s to pick the best idea so be creative and have fun! 

PDC BOF: Will cloud computing change your life?

PDC BOF: Will cloud computing change your life?

I’m going to be participating in one of the lunchtime BOF’s at PDC this year.  We’ll be talking about cloud computing and the likelihood of it changing your life in the future.  Here’s the description from the PDC BOF website:

“Cloud Computing” is a reality and is changing the technology industry. Your professional life will be impacted whether you choose a solution from Amazon, Google, Microsoft, or others.

  • How quickly will it change the economic paradigm of companies and their priorities?
  • How much will you have to learn?
  • What new opportunities will arise?
  • How soon will it affect your job?

You will benefit from this special discussion whatever your role is in the technology world.

Hope to see you at PDC.  Be sure to stop by the Pluralsight booth and grab a t-shirt.

My .NET Rocks interview on building a real cloud app

My .NET Rocks interview on building a real cloud app

You can now download my latest .NET Rocks interview on building a real cloud app. During the interview we discussed how we used a cloud computing strategy here at Pluralsight to build out our Pluralsight On-Demand! online training system. We were able to touch on many of the interesting business issues around cloud computing, including the economics, what makes sense and what might not. We also spent some time talking about the differences between the Amazon and Microsoft cloud computing platforms and the key strengths of each company.