Move is_a_date_arg to DateTimeFormat::isYearMonth
- Improved functionality - Added tests
This commit is contained in:
+9
-2
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\ForumManager;
|
||||
use Friendica\Content\Nav;
|
||||
@@ -51,9 +52,12 @@ function network_init(App $a)
|
||||
$group_id = 0;
|
||||
}
|
||||
|
||||
/** @var DateTimeFormat $dtFormat */
|
||||
$dtFormat = BaseObject::getClass(DateTimeFormat::class);
|
||||
|
||||
if ($a->argc > 1) {
|
||||
for ($x = 1; $x < $a->argc; $x ++) {
|
||||
if (is_a_date_arg($a->argv[$x])) {
|
||||
if ($dtFormat->isYearMonth($a->argv[$x])) {
|
||||
$is_a_date_query = true;
|
||||
break;
|
||||
}
|
||||
@@ -461,9 +465,12 @@ function networkThreadedView(App $a, $update, $parent)
|
||||
|
||||
$default_permissions = [];
|
||||
|
||||
/** @var DateTimeFormat $dtFormat */
|
||||
$dtFormat = BaseObject::getClass(DateTimeFormat::class);
|
||||
|
||||
if ($a->argc > 1) {
|
||||
for ($x = 1; $x < $a->argc; $x ++) {
|
||||
if (is_a_date_arg($a->argv[$x])) {
|
||||
if ($dtFormat->isYearMonth($a->argv[$x])) {
|
||||
if ($datequery) {
|
||||
$datequery2 = Strings::escapeHtml($a->argv[$x]);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user