From 7bc90ca331147e28eb7c8ab9097d4f9e2e10237d Mon Sep 17 00:00:00 2001 From: AnuzPandey Date: Sun, 1 Sep 2024 00:55:27 +0545 Subject: [PATCH] :hammer: fix: toFormattedNepaliDate to use config values and remove required arguments. --- src/Traits/NepaliDateTrait.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Traits/NepaliDateTrait.php b/src/Traits/NepaliDateTrait.php index 11423ef..81c88ec 100644 --- a/src/Traits/NepaliDateTrait.php +++ b/src/Traits/NepaliDateTrait.php @@ -99,14 +99,14 @@ public function toNepaliDate(?string $format = null, ?string $locale = null): st { $this->performCalculationOnEnglishDate(); - return $this->toFormattedNepaliDate( - $format ?? config('nepali-date.default_format'), - $locale ?? config('nepali-date.default_locale'), - ); + return $this->toFormattedNepaliDate($format, $locale); } - public function toFormattedNepaliDate(string $format, string $locale): string + public function toFormattedNepaliDate(?string $format = null, ?string $locale = null): string { + $format = $format ?? config('nepali-date.default_format'); + $locale = $locale ?? config('nepali-date.default_locale'); + $nepaliDateArray = $this->toNepaliDateArrayData(); return $this->formatDateString($format, $locale, $nepaliDateArray);