Skip to content

Commit e86b02d

Browse files
author
David Nahodyl
committed
changed date formatting for reliability
1 parent 0caa5e0 commit e86b02d

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

src/Database/Eloquent/FMModel.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@ abstract class FMModel extends Model
1919

2020
use FMHasRelationships;
2121

22-
23-
/**
24-
* The text format to use when saving/retrieving Date fields from FileMaker
25-
* @var string
26-
*/
27-
protected $dateFormat = 'n/j/Y g:i:s A';
28-
2922
/**
3023
* Indicates if the model should be timestamped.
3124
*
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace BlueFeather\EloquentFileMaker\Database\Query\Grammars;
4+
5+
use Illuminate\Database\Query\Grammars\Grammar;
6+
7+
class FMGrammar extends Grammar
8+
{
9+
10+
/**
11+
* Get the format for database stored dates.
12+
*
13+
* @return string
14+
*/
15+
public function getDateFormat()
16+
{
17+
return 'n/j/Y g:i:s A';
18+
}
19+
20+
}

src/Services/FileMakerConnection.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use BlueFeather\EloquentFileMaker\Database\Eloquent\FMEloquentBuilder;
88
use BlueFeather\EloquentFileMaker\Database\Query\FMBaseBuilder;
9+
use BlueFeather\EloquentFileMaker\Database\Query\Grammars\FMGrammar;
910
use BlueFeather\EloquentFileMaker\Exceptions\FileMakerDataApiException;
1011
use GuzzleHttp\Exception\ConnectException;
1112
use GuzzleHttp\Exception\RequestException;
@@ -631,4 +632,9 @@ protected function retryMiddleware()
631632
return 0;
632633
});
633634
}
635+
636+
protected function getDefaultQueryGrammar()
637+
{
638+
return new FMGrammar();
639+
}
634640
}

0 commit comments

Comments
 (0)