Add Temporal::utc() shorthand to Temporal::convert()
This commit is contained in:
parent
ca8209a2ce
commit
35d06bd9eb
22 changed files with 173 additions and 128 deletions
|
@ -203,8 +203,8 @@ function cal_content(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$start = Temporal::convert($start);
|
||||
$finish = Temporal::convert($finish);
|
||||
$start = Temporal::utc($start);
|
||||
$finish = Temporal::utc($finish);
|
||||
|
||||
$adjust_start = Temporal::convert($start, date_default_timezone_get());
|
||||
$adjust_finish = Temporal::convert($finish, date_default_timezone_get());
|
||||
|
@ -231,7 +231,7 @@ function cal_content(App $a)
|
|||
if (DBM::is_result($r)) {
|
||||
$r = sort_by_date($r);
|
||||
foreach ($r as $rr) {
|
||||
$j = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::convert($rr['start'], 'UTC', 'UTC', 'j'));
|
||||
$j = $rr['adjust'] ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::utc($rr['start'], 'j');
|
||||
if (!x($links, $j)) {
|
||||
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ function dfrn_request_post(App $a)
|
|||
// Block friend request spam
|
||||
if ($maxreq) {
|
||||
$r = q("SELECT * FROM `intro` WHERE `datetime` > '%s' AND `uid` = %d",
|
||||
dbesc(Temporal::convert('now - 24 hours')),
|
||||
dbesc(Temporal::utc('now - 24 hours')),
|
||||
intval($uid)
|
||||
);
|
||||
if (DBM::is_result($r) && count($r) > $maxreq) {
|
||||
|
|
|
@ -81,9 +81,9 @@ function events_post(App $a) {
|
|||
$finish = Temporal::convert($finish, 'UTC', date_default_timezone_get());
|
||||
}
|
||||
} else {
|
||||
$start = Temporal::convert($start);
|
||||
$start = Temporal::utc($start);
|
||||
if (! $nofinish) {
|
||||
$finish = Temporal::convert($finish);
|
||||
$finish = Temporal::utc($finish);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,8 +323,8 @@ function events_content(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
$start = Temporal::convert($start);
|
||||
$finish = Temporal::convert($finish);
|
||||
$start = Temporal::utc($start);
|
||||
$finish = Temporal::utc($finish);
|
||||
|
||||
$adjust_start = Temporal::convert($start, date_default_timezone_get());
|
||||
$adjust_finish = Temporal::convert($finish, date_default_timezone_get());
|
||||
|
@ -351,7 +351,7 @@ function events_content(App $a) {
|
|||
if (DBM::is_result($r)) {
|
||||
$r = sort_by_date($r);
|
||||
foreach ($r as $rr) {
|
||||
$j = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::convert($rr['start'], 'UTC', 'UTC', 'j'));
|
||||
$j = $rr['adjust'] ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::utc($rr['start'], 'j');
|
||||
if (! x($links,$j)) {
|
||||
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ function lostpass_content(App $a)
|
|||
}
|
||||
|
||||
// Password reset requests expire in 60 minutes
|
||||
if ($user['pwdreset_time'] < Temporal::convert('now - 1 hour')) {
|
||||
if ($user['pwdreset_time'] < Temporal::utc('now - 1 hour')) {
|
||||
$fields = [
|
||||
'pwdreset' => null,
|
||||
'pwdreset_time' => null
|
||||
|
|
|
@ -225,7 +225,7 @@ function ping_init(App $a)
|
|||
WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s' and `ignore` = 0
|
||||
ORDER BY `start` ASC ",
|
||||
intval(local_user()),
|
||||
dbesc(Temporal::convert('now + 7 days')),
|
||||
dbesc(Temporal::utc('now + 7 days')),
|
||||
dbesc(Temporal::utcNow())
|
||||
);
|
||||
if (DBM::is_result($ev)) {
|
||||
|
|
|
@ -218,10 +218,11 @@ function profiles_post(App $a) {
|
|||
$ignore_year = true;
|
||||
$dob = substr($dob, 5);
|
||||
}
|
||||
$dob = Temporal::convert((($ignore_year) ? '1900-' . $dob : $dob), 'UTC', 'UTC', (($ignore_year) ? 'm-d' : 'Y-m-d'));
|
||||
|
||||
if ($ignore_year) {
|
||||
$dob = '0000-' . $dob;
|
||||
$dob = '0000-' . Temporal::utc('1900-' . $dob, 'm-d');
|
||||
} else {
|
||||
$dob = Temporal::utc($dob, 'Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue