mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-12-22 10:25:01 +00:00
[server/device-data] Add start/end datetime checking
This commit is contained in:
parent
a34efe5c25
commit
b34ba0dc0b
1 changed files with 9 additions and 0 deletions
|
@ -51,6 +51,15 @@ class DeviceData implements IAction {
|
|||
$this->validator->is_datetime("end");
|
||||
$this->validator->run();
|
||||
|
||||
if(new \DateTime($_GET["start"]) > new \DateTime($_GET["end"])) {
|
||||
$this->sender->send_error_plain(
|
||||
400, "Error: The start date must be earlier than the end date.", [
|
||||
[ "x-time-taken", PerfFormatter::format_perf_data($start_time, $start_handle, null) ]
|
||||
]
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!empty($_GET["average-seconds"]) && intval($_GET["average-seconds"]) == 0) {
|
||||
$this->sender->send_error_plain(
|
||||
400, "Error: That average-seconds value is invalid (an integer greater than 0 required).", [
|
||||
|
|
Loading…
Reference in a new issue