Move is_a_date_arg to DateTimeFormat::isYearMonth
- Improved functionality - Added tests
This commit is contained in:
parent
52c42491c4
commit
ad67fd3aa8
5 changed files with 107 additions and 22 deletions
|
@ -72,22 +72,3 @@ function get_cats_and_terms($item)
|
|||
|
||||
return [$categories, $folders];
|
||||
}
|
||||
|
||||
/// @TODO Rewrite this
|
||||
function is_a_date_arg($s) {
|
||||
$i = intval($s);
|
||||
|
||||
if ($i > 1900) {
|
||||
$y = date('Y');
|
||||
|
||||
if ($i <= $y + 1 && strpos($s, '-') == 4) {
|
||||
$m = intval(substr($s, 5));
|
||||
|
||||
if ($m > 0 && $m <= 12) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue