fixbug timezone and add facades

This commit is contained in:
nasser committed 2017-09-14 20:13:37 +04:30
1 parent 1b72a5e0fe
commit 2acc6826ab
5 files changed
+22 -4

No files matched your search

+1
View File
@@ -52,6 +52,7 @@ create object with pass string
```php
$v = new Verta('2016-12-27 14:12:32');
$v = Verta::instance('2016-12-25 11:12:36');
$v = Facades\Verta::instance('2016-12-25 11:12:36');
```
create object with timestamp
+2 -1
View File
@@ -10,7 +10,8 @@
],
"keywords": ["Laravel","Date","Datetime","Jalali", "Shamsi", "Verta"],
"require": {
"php": ">=5.5"
"php": ">=5.5",
"illuminate/support": "^5.0"
},
"require-dev" : {},
"autoload": {
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Hekmatinasser\Verta\Facades;
use Illuminate\Support\Facades\Facade;
class Verta extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'verta';
}
}
-1
View File
@@ -254,7 +254,6 @@ class Verta extends DateTime {
* @param bool $timezone [optional]
*/
public function __construct($datetime = null, $timezone = null) {
date_default_timezone_set('Asia/Tehran');
if ($datetime === null) {
$instance = time();
}
+2 -2
View File
@@ -4,8 +4,8 @@ if (! function_exists('verta')) {
* @param string $str
* @return \Hekmatinasse\Verta\Verta
*/
function verta($string = null)
function verta($string = null, $timezone = null)
{
return \Hekmatinasser\Verta\Verta::instance($string);
return \Hekmatinasser\Verta\Verta::instance($string, $timezone);
}
}