diff --git a/app/Services/TimeService.php b/app/Services/TimeService.php index d805bbb..15cd02c 100644 --- a/app/Services/TimeService.php +++ b/app/Services/TimeService.php @@ -167,8 +167,13 @@ class TimeService return null; } - $sourceTz = $sourceTz ?: $this->serverTimezone; $targetTz = $targetTz ?: $this->userTimezone(); + if ($sourceTz === null && $this->isDateOnlyString($value)) { + // Date-only strings should not shift across timezones. + $sourceTz = $targetTz; + } else { + $sourceTz = $sourceTz ?: $this->serverTimezone; + } try { if ($value instanceof Time) { @@ -204,4 +209,14 @@ class TimeService { return (string) ($this->toUTC($value, $fromTz, $format) ?? ''); } + + private function isDateOnlyString($value): bool + { + if (!is_string($value)) { + return false; + } + + $value = trim($value); + return (bool) preg_match('/^\d{4}-\d{2}-\d{2}$/', $value); + } }