Fix scheduled_at datetime format mismatch
datetime-local sends ISO format with T separator; normalize to space on save and use SQLite datetime() in dispatcher query to handle both formats. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
30d2b53075
commit
8ab9b7bbe2
2 changed files with 3 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ $stmt = $db->prepare("
|
||||||
JOIN projects pr ON pr.id = t.project_id AND pr.is_active = 1
|
JOIN projects pr ON pr.id = t.project_id AND pr.is_active = 1
|
||||||
WHERE t.status = 'pending'
|
WHERE t.status = 'pending'
|
||||||
AND p.status IN ('pending', 'partial')
|
AND p.status IN ('pending', 'partial')
|
||||||
AND p.scheduled_at <= ?
|
AND datetime(p.scheduled_at) <= datetime(?)
|
||||||
ORDER BY p.scheduled_at ASC, t.id ASC
|
ORDER BY p.scheduled_at ASC, t.id ASC
|
||||||
");
|
");
|
||||||
$stmt->execute([$now]);
|
$stmt->execute([$now]);
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ if ($action === 'save_settings') {
|
||||||
if ($action === 'create') {
|
if ($action === 'create') {
|
||||||
$content = trim($input['content'] ?? '');
|
$content = trim($input['content'] ?? '');
|
||||||
$image_path = trim($input['image_path'] ?? '');
|
$image_path = trim($input['image_path'] ?? '');
|
||||||
$scheduled_at = trim($input['scheduled_at'] ?? '');
|
$scheduled_at = str_replace('T', ' ', trim($input['scheduled_at'] ?? ''));
|
||||||
$targets = $input['targets'] ?? [];
|
$targets = $input['targets'] ?? [];
|
||||||
|
|
||||||
if (!$content) { echo json_encode(['error' => 'Content required']); exit; }
|
if (!$content) { echo json_encode(['error' => 'Content required']); exit; }
|
||||||
|
|
@ -127,7 +127,7 @@ if ($action === 'update') {
|
||||||
$id = (int)($input['id'] ?? 0);
|
$id = (int)($input['id'] ?? 0);
|
||||||
$content = trim($input['content'] ?? '');
|
$content = trim($input['content'] ?? '');
|
||||||
$image_path = trim($input['image_path'] ?? '');
|
$image_path = trim($input['image_path'] ?? '');
|
||||||
$scheduled_at = trim($input['scheduled_at'] ?? '');
|
$scheduled_at = str_replace('T', ' ', trim($input['scheduled_at'] ?? ''));
|
||||||
$targets = $input['targets'] ?? [];
|
$targets = $input['targets'] ?? [];
|
||||||
|
|
||||||
if (!$id) { echo json_encode(['error' => 'id required']); exit; }
|
if (!$id) { echo json_encode(['error' => 'id required']); exit; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue