Riddle me this, Firefox...

Upchurch

Papa Funkosophy
Joined
May 10, 2002
Messages
34,265
Location
St. Louis, MO
Using Firefox 1.5, I've come across an unusual error. On our live site, everything works fine, but when I view our development site (which is supposed to be nearly identical, I get an SQL error due to the fact that it is reading the date as dd/mm/yyyy instead of mm/dd/yyyy. Both sites work fine in ID, it's just devl site on Firefox.

Now I've scanned through my settings. The only extensions I have for Firefox is Google Toolbar, IE Tab, and Tab Mix Plus. The page in question gives slightly different results when viewed as Firefox or IE in Firefox, but the root cause of the error seems to be the date format.

Now, what might be causing Firefox to confuse date formats in this one case and not others?
 
SQL error? Could you be a bit more specific about what the page is doing?

I'm in the middle of coding a struts-based reporting app, so right now I am The Man when it comes to date formats. :)
 
Code:
-2147217913 
   
  The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. 
   
  SQL:SELECT TOP 2 UID, AdUnitPage, AdType, PI FROM AdContent WHERE AdUnitSize='728X90' and datestart<='26/07/2006' and datestop>='26/07/2006' and datestop>='26/07/2006' and available>0 order by LastViewed;

Our asp provides this data when it encounters this kind of problem. Note the date format.

I reset all Firefox preferences and it seems to be working again. I don't know which one made the difference.
 
Sounds like the app is feeding a client side - and thus untrustworthy - date into the proc...
 
What ES said. I encourage you to rethink the structure of this app.
Especially considering if it's using the client's Date format, it might be using the client's timestamp as well. Pretty scary considering how far off most people's computers are!
 
Many revisions planned, but we have to support the current system until that point. You know how it goes.
 
Many revisions planned, but we have to support the current system until that point. You know how it goes.

It just screams security problems, but at this point what I would do is run a Javascript function to force a format of the date.

For example, if you absolutely, positively, need a MM/DD/YYYY format, do something like this:

Code:
function formatNumber(i) {
	if(i< 10) {
		return("0" + i);
	}
	else {
		return(i);
	}
}

function formatDate() {
	var today = new Date();
	var day = today.getDate();
	var month = today.getMonth() + 1; // Month is 0-based
	var year = today.getYear();
	
	// Some clients do "year" as years since 1900, eg 106
	if(year < 1000) { 
		year += 1900;
	}
	
	var str = formatNumber(month) + "/" + formatNumber(day) + "/" + year;
	return(str);
}

ETA: And for the love of Jebus, redevelop that app!!!!
 
Two sentences, surely? And only one of them particularly pithy, I'd've thought.

Cheers,
Rat.
 

Back
Top Bottom