-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(formatter)!:
duration()
fraction secconds and new format synta…
…x support (#108)
- Loading branch information
Showing
13 changed files
with
696 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
use Illuminate\Container\Container; | ||
use Illuminate\Support\Facades\Date; | ||
use LastDragon_ru\LaraASP\Dev\App\Example; | ||
use LastDragon_ru\LaraASP\Formatter\Formatter; | ||
use LastDragon_ru\LaraASP\Formatter\Package; | ||
|
||
Example::config(Package::Name, [ | ||
'options' => [ | ||
Formatter::Date => 'default', | ||
], | ||
'all' => [ | ||
Formatter::Date => [ | ||
'default' => 'd MMM yyyy', | ||
'custom' => 'yyyy/MM/dd', | ||
], | ||
], | ||
'locales' => [ | ||
'ru_RU' => [ | ||
Formatter::Date => [ | ||
'custom' => 'dd.MM.yyyy', | ||
], | ||
], | ||
], | ||
]); | ||
|
||
$datetime = Date::make('2023-12-30T20:41:40.000018+04:00'); | ||
$default = Container::getInstance()->make(Formatter::class); | ||
$locale = $default->forLocale('ru_RU'); | ||
|
||
Example::dump($default->date($datetime)); | ||
Example::dump($default->date($datetime, 'custom')); | ||
Example::dump($locale->date($datetime)); | ||
Example::dump($locale->date($datetime, 'custom')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
"${BASH_SOURCE%/*}/../../../../dev/artisan" dev:example "${BASH_SOURCE%.*}.php" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
use Illuminate\Container\Container; | ||
use LastDragon_ru\LaraASP\Dev\App\Example; | ||
use LastDragon_ru\LaraASP\Formatter\Formatter; | ||
|
||
$default = Container::getInstance()->make(Formatter::class); // For default app locale | ||
$locale = $default->forLocale('ru_RU'); // For ru_RU locale | ||
|
||
Example::dump($default->duration(123.454321)); | ||
Example::dump($locale->duration(123.4543)); | ||
Example::dump($locale->duration(1_234_543)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
"${BASH_SOURCE%/*}/../../../../dev/artisan" dev:example "${BASH_SOURCE%.*}.php" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.