Skip to content

Commit

Permalink
Better way how to handle DateTime format
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitexus committed Mar 17, 2024
1 parent bb04077 commit de2993b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/AbraFlexi/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class DateTime extends \DateTime
* @var string
*/

public static $format = 'Y-m-d\TH:i:s';

public static $format = 'Y-m-d\TH:i:s.u+P';
/**
* AbraFlexi dateTime to PHP DateTime conversion
*
Expand All @@ -52,6 +52,18 @@ public function __construct(string $flexidatetime = 'NOW')
}
}

/**
* Easy way how to force format DateTime used
*
* @param string
*
* @return \DateTime | false
*/
public function setFormat(sting $format){
self::$format = $format;
return $this;
}

/**
* Render Object as AbraFlexi::$DateTimeFormat
*
Expand Down

0 comments on commit de2993b

Please sign in to comment.