add support of 3-letter weekdays for duedate in smart syntax

This commit is contained in:
maxpozdeev 2023-09-10 12:01:39 +03:00
parent 28bd570436
commit 628f5ed673

View file

@ -10,6 +10,7 @@ class MTTSmartSyntax implements MTTSmartSyntaxInterface
{
protected $tagPrefix = '#';
protected $duedatePrefix = '@!';
protected $weekdays = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; //3-letter not present in lang
/** @var MTTSmartSyntaxInterface */
protected static $instance;
@ -102,6 +103,14 @@ class MTTSmartSyntax implements MTTSmartSyntaxInterface
break;
}
}
if (null === $wd) {
foreach ($this->weekdays as $idx => $weekday) {
if ($needle === $weekday) {
$wd = $idx;
break;
}
}
}
if (null === $wd) {
foreach ($lang->get('days_long') as $idx => $weekday) {
if ($needle === mb_strtolower($weekday)) {