21 return new DateTime($dateInUserTimezone->getTimestamp());
30 $date = self::getMonday();
32 return new DateTime($date->getTimestamp());
41 $date = self::getMonday();
42 $date->add(
'+1 week');
44 return new DateTime($date->getTimestamp());
53 $date = self::getMonday();
54 $date->add(
'-1 week');
56 return new DateTime($date->getTimestamp());
65 $date = self::getFirstDayOfMonth(strtotime(
'first day of this month'));
67 return new DateTime($date->getTimestamp());
76 $date = self::getFirstDayOfMonth(strtotime(
'first day of this month'));
77 $date->add(
'+1 month');
79 return new DateTime($date->getTimestamp());
88 $date = self::getFirstDayOfMonth(strtotime(
'first day of this month'));
89 $date->add(
'-1 month');
91 return new DateTime($date->getTimestamp());
96 $timestamp = strtotime(
'monday this week');
98 $date = Main\Type\DateTime::createFromTimestamp($timestamp);
99 $date->setTime(0, 0, 0);
102 $todayDate->setTime(0, 0, 0);
104 if ($date->format(
'Y-m-d') === $todayDate->format(
'Y-m-d'))
107 $todayInUserTimezone->toUserTime();
109 if ($todayInUserTimezone->format(
'N') ==
'7')
111 $date->add(
'-1 week');
118 private static function getFirstDayOfMonth(): Main\
Type\DateTime
120 $timestamp = strtotime(
'first day of this month');
122 $date = Main\Type\DateTime::createFromTimestamp($timestamp);
123 $date->setTime(0, 0, 0);
126 $todayDate->setTime(0, 0, 0);
128 if ($date->format(
'Y-m-d') === $todayDate->format(
'Y-m-d'))
131 $todayInUserTimezone->toUserTime();
133 if ((
int)($todayInUserTimezone->format(
'j')) >= 28)
135 $date->add(
'-1 month');
static createCurrentWeekMonday()
static createFirstDayOfCurrentMonth()
static createNextWeekMonday()
static createFirstDayOfLastMonth()
static createFirstDayOfNextMonth()
static createLastWeekMonday()