File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ Detailed [config/imap.php](src/config/imap.php) configuration:
121121 - ` validate_cert ` &mdash ; decide weather you want to verify the certificate or not
122122 - ` username ` &mdash ; imap account username
123123 - ` password ` &mdash ; imap account password
124+ - ` date_format ` &mdash ; The default date format is used to convert any given Carbon::class object into a valid date string. (` d-M-Y ` , ` d-M-y ` , ` d M y ` )
124125 - ` options ` &mdash ; additional fetch options
125126 - ` delimiter ` &mdash ; you can use any supported char such as ".", "/", etc
126127 - ` fetch ` &mdash ; ` IMAP::FT_UID ` (message marked as read by fetching the message) or ` IMAP::FT_PEEK ` (fetch the message without setting the "read" flag)
Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ class Query {
5757 /** @var int $fetch_flags */
5858 protected $ fetch_flags = true ;
5959
60+ /** @var string $date_format */
61+ protected $ date_format ;
62+
6063 /**
6164 * Query constructor.
6265 * @param Client $client
@@ -67,6 +70,8 @@ public function __construct(Client $client, $charset = 'UTF-8') {
6770
6871 if (config ('imap.options.fetch ' ) === IMAP ::FT_PEEK ) $ this ->leaveUnread ();
6972
73+ $ this ->date_format = config ('imap.date_format ' , 'd M y ' );
74+
7075 $ this ->charset = $ charset ;
7176 $ this ->query = collect ();
7277 $ this ->boot ();
@@ -86,7 +91,7 @@ protected function boot(){}
8691 protected function parse_value ($ value ){
8792 switch (true ){
8893 case $ value instanceof \Carbon \Carbon:
89- $ value = $ value ->format (' d M y ' );
94+ $ value = $ value ->format ($ this -> date_format );
9095 break ;
9196 }
9297
Original file line number Diff line number Diff line change 2424 */
2525 'default ' => env ('IMAP_DEFAULT_ACCOUNT ' , 'default ' ),
2626
27+ /*
28+ |--------------------------------------------------------------------------
29+ | Default date format
30+ |--------------------------------------------------------------------------
31+ |
32+ | The default date format is used to convert any given Carbon::class object into a valid date string.
33+ | These are currently known working formats: "d-M-Y", "d-M-y", "d M y"
34+ |
35+ */
36+ 'date_format ' => 'd-M-Y ' ,
37+
2738 /*
2839 |--------------------------------------------------------------------------
2940 | Available IMAP accounts
You can’t perform that action at this time.
0 commit comments