Skip to content

Commit

Permalink
✨ refac:
Browse files Browse the repository at this point in the history
-  cleanup toFormatted methods and update docblock comment on config file
  • Loading branch information
anuzpandey committed Feb 16, 2024
1 parent 1078847 commit 29d1418
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
24 changes: 20 additions & 4 deletions config/nepali-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@

return [
/*
* Default date format
*/
|--------------------------------------------------------------------------
| Default Format
|--------------------------------------------------------------------------
|
| This value defines the default date format used for conversions when
| no format is explicitly given. You can customize the format string
| according to their preferences using PHP date format characters.
|
| Supported format characters can be found at:
| https://laravel-nepali-date.anuzpandey.com/docs/formatting/format-strings
*/
'default_format' => 'Y-m-d',

/*
* Default locale
*/
|--------------------------------------------------------------------------
| Default Locale
|--------------------------------------------------------------------------
|
| This value specifies the default locale used for date conversions when
| no locale is explicitly provided. You can set the locale to 'en' for
| English or 'np' for Nepali, ascertaining consistent presentation.
|
*/
'default_locale' => 'en',
];
5 changes: 1 addition & 4 deletions src/Traits/EnglishDateTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ public function performCalculationBasedOnNepaliDays(string|int $totalNepaliDays)
$this->dayOfWeek = $_day;
}

public function toFormattedEnglishDate(
string $format = 'd F Y, l',
string $locale = 'en'
): string
public function toFormattedEnglishDate(string $format, string $locale): string
{
$englishDateArray = $this->toEnglishDateArray();

Expand Down
5 changes: 1 addition & 4 deletions src/Traits/NepaliDateTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ public function toNepaliDate(string $format = null, string $locale = null): stri
);
}

public function toFormattedNepaliDate(
string $format = 'Y-m-d',
string $locale = 'np'
): string
public function toFormattedNepaliDate(string $format, string $locale): string
{
$nepaliDateArray = $this->toNepaliDateArray();

Expand Down

0 comments on commit 29d1418

Please sign in to comment.