Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Why does it return true if date is blank? That's just... Odd...
Also what language is this? Powershell? -
nnee4695yThe question of the decade. No one knows. I don't. You don't. The guy who wrote it certainly doesn't know.
Powershell could compete but it's php. -
nnee4695yNope. It checks if value passed matches certain, some pointless, criteria. Nowhere in the chain has such defaults. Not that I've seen, at least. It just makes no sense. And the guy who wrote it no longer works there, of course. It's some 10 years old code
-
@nnee I guess... It's the usual left over. Maybe checking year 2000 compatiblity.... Maybe checking invalid timestamps... Maybe the rest of an frustrated, sexless, alcohol toxicated night. Noone knows.
-
C0D4681385yIf(!strtotime($value)== false){
// tada! I'm a valid date, let's do some real validations
}
I can understand verifying the date is greater then 2000 and less then 2100 but that whole thing you posted is that one line ^^
Related Rants
-
opengenus0Turn your usual habit into something that everyone praises
-
blol3Company: Govt says you should stay home to prevent spreading the disease. PLZ WFH. People start to WFH. VPN g...
-
Fast-Nop4The best part about home office isn't that you can fart without co-workers getting annoyed. It's that you can ...
Still trying to understand a good old pile of legacy:
function isValidDate($value) {
if ($value == "" || ($value == 0 && is_numeric($value)) {
return true;
}
// goes on to check if value is some number between 2000 and current year
}
rant
wk201