TZ and editable fields
This commit is contained in:
@@ -25,6 +25,13 @@ if (!in_array($column, $allowed_columns)) {
|
||||
die(json_encode(['error' => 'Invalid column']));
|
||||
}
|
||||
|
||||
// Convert eta or etd to UTC if supplied
|
||||
if (in_array($column, ['eta', 'etd'])) {
|
||||
$date = new DateTime($new_value, new DateTimeZone('Europe/London'));
|
||||
$date->setTimezone(new DateTimeZone('UTC'));
|
||||
$new_value = $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
$stmt = $conn->prepare("UPDATE submitted SET `$column` = ? WHERE id = ?");
|
||||
if (!$stmt) {
|
||||
die(json_encode(['error' => 'Prepare statement failed']));
|
||||
|
||||
Reference in New Issue
Block a user