mirror of
https://github.com/grocy/grocy.git
synced 2026-04-07 05:16:15 +02:00
Fixed error with negative offset
This commit is contained in:
parent
f74227f738
commit
f602719794
|
|
@ -87,7 +87,10 @@ class ApplicationService extends BaseService
|
||||||
private static function getSqliteLocaltime(int $offset):string
|
private static function getSqliteLocaltime(int $offset):string
|
||||||
{
|
{
|
||||||
$pdo = new \PDO('sqlite::memory:');
|
$pdo = new \PDO('sqlite::memory:');
|
||||||
return $pdo->query('SELECT datetime(\'now\', \'+' . $offset . ' seconds\', \'localtime\');')->fetch()[0];
|
if ($offset > 0)
|
||||||
|
return $pdo->query('SELECT datetime(\'now\', \'+' . $offset . ' seconds\', \'localtime\');')->fetch()[0];
|
||||||
|
else
|
||||||
|
return $pdo->query('SELECT datetime(\'now\', \'' . $offset . ' seconds\', \'localtime\');')->fetch()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user