Fix datetime parser
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# phpvms <sup>7</sup>
|
# phpvms <sup>7</sup>
|
||||||
|
|
||||||
[](https://travis-ci.org/nabeelio/phpvms) [](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&utm_medium=referral&utm_content=nabeelio/phpvms&utm_campaign=Badge_Grade) [](https://packagist.org/packages/nabeel/phpvms) [](https://packagist.org/packages/nabeel/phpvms) [](https://packagist.org/packages/nabeel/phpvms) [](https://packagist.org/packages/nabeel/phpvms)
|
[](https://travis-ci.org/nabeelio/phpvms) [](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&utm_medium=referral&utm_content=nabeelio/phpvms&utm_campaign=Badge_Grade) [](https://packagist.org/packages/nabeel/phpvms)  [](https://packagist.org/packages/nabeel/phpvms)
|
||||||
|
|
||||||
The next phpvms version built on the laravel framework. work in progress. If you're looking for
|
The next phpvms version built on the laravel framework. work in progress. If you're looking for
|
||||||
the old, phpVMS classic, it's [available here](https://github.com/nabeelio/phpvms_v2).
|
the old, phpVMS classic, it's [available here](https://github.com/nabeelio/phpvms_v2).
|
||||||
|
|||||||
@@ -147,11 +147,19 @@ class AcarsController extends Controller
|
|||||||
$position['type'] = AcarsType::FLIGHT_PATH;
|
$position['type'] = AcarsType::FLIGHT_PATH;
|
||||||
|
|
||||||
if (array_key_exists('sim_time', $position)) {
|
if (array_key_exists('sim_time', $position)) {
|
||||||
$position['sim_time'] = Carbon::createFromTimeString($position['sim_time']);
|
if ($position['sim_time'] instanceof \DateTime) {
|
||||||
|
$position['sim_time'] = Carbon::instance($position['sim_time']);
|
||||||
|
} else {
|
||||||
|
$position['sim_time'] = Carbon::createFromTimeString($position['sim_time']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('created_at', $position)) {
|
if (array_key_exists('created_at', $position)) {
|
||||||
$position['created_at'] = Carbon::createFromTimeString($position['created_at']);
|
if ($position['created_at'] instanceof \DateTime) {
|
||||||
|
$position['created_at'] = Carbon::instance($position['created_at']);
|
||||||
|
} else {
|
||||||
|
$position['created_at'] = Carbon::createFromTimeString($position['created_at']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$update = Acars::create($position);
|
$update = Acars::create($position);
|
||||||
|
|||||||
@@ -78,6 +78,12 @@ class MetarTest extends TestCase
|
|||||||
$this->assertEquals('AO2 PK WND 27045/2128 PRESRR SLP018 T01221044', $parsed['remarks']);
|
$this->assertEquals('AO2 PK WND 27045/2128 PRESRR SLP018 T01221044', $parsed['remarks']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMetar2()
|
||||||
|
{
|
||||||
|
$metar = 'EGLL 261250Z AUTO 17014KT 8000 -RA BKN010/// '
|
||||||
|
.'BKN016/// OVC040/// //////TCU 13/12 Q1008 TEMPO 4000 RA';
|
||||||
|
}
|
||||||
|
|
||||||
public function testMetarTrends()
|
public function testMetarTrends()
|
||||||
{
|
{
|
||||||
$metar =
|
$metar =
|
||||||
@@ -116,4 +122,5 @@ class MetarTest extends TestCase
|
|||||||
$this->assertEquals('VFR', $metar['category']);
|
$this->assertEquals('VFR', $metar['category']);
|
||||||
$this->assertNotNull($metar);
|
$this->assertNotNull($metar);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user