This project is in MOSS, using jQuery 1.6.1.

The basics of what I need: When the user filters on a date field, the value of the filter option needs to be "yyyy-M-d" while the text is "M/d/yyyy."

Reason: When the list is filtered, the page is reloaded and the querystring is appended with the &FilterField1=MyColumn&FilterValue1=03%2f07%2f2012. Code that I can't touch is then using the querystring to export the list with the filter in place and is choking on the %2f in the date.

Manually changing the querystring to ...FilterValue1=2012-03-07 allows the page filter to still work AND the export module doesn't barf on it.


  1. Is there a way to make SP use yyyy-M-d for the value and M/d/yyyy for the text? (I don't think so, because it appears to build the list from retrieved data which only include the M/d/yyyy text. I would be happy to be proved wrong, though.)
  2. Since I don't know of a way to do #1, I'm trying to manipulate it with jQuery... but the timing is kicking me hard: the filter select isn't loaded until the user clicks the filter/sort dropdown arrow; and then it's built in a separate page (/_layouts/filter.aspx) and displayed in an iFrame.
  3. I don't really want to go this route, because it will require a lot of overhead to duplicate existing functionality, but I suppose I could override the default behavior for my date fields and load them myself with SPServices, so that I could set the value and text as I see fit.

What suggestions have ye, oh wise ones?

Blessings, Jim Bob

  • Don't have a 2007 VM turned on right now, but can you look at what parameters (if any) are passed into /_layouts/filter.aspx? You may be able to hijack the click handler and then ajax the filters into the page. You could then modify the results accordingly, since it's simply data at that point.
    – iOnline247
    Mar 7, 2012 at 14:44

1 Answer 1


Is the code running on page load, or is there some kind of button that the user has to press before the export begins? If it doesn't run on page load, you could use window.location.replace() to redirect the user to a new URL after parsing out the date values and re-arranging them. Something like this (untested):

( function() {
if ( window.location.href.split( 'FilterValue1=' )[1].indexOf( '%2f' ) !== -1 || window.location.href.split( 'FilterValue1=' )[1].indexOf( '%2F' ) !== -1 ) {

    // Depending on what other parameters are present, you may not need all of this string manipulation
    var urlBeforeDate = window.location.href.split( 'FilterValue1=' )[0] + "FilterValue1=";
    var urlAfterDate = "&" + window.location.href.split( 'FilterValue1=' )[1].split( '&' )[1];
    var dateParameter = window.location.href.split( 'FilterValue1=' )[1].split( '&' )[0].split( '%2F' );
    var newURL = urlBeforeDate + dateParameter[2] + "-" + dateParameter[1] + "-" + dateParameter[0] + urlAfterDate;

    window.location.replace( newURL );


  • Thanks, Josh. Yes, the user has to click a button to export. And I was getting ready to try your approach as well. Will let you know how that goes. Mar 7, 2012 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.