Skip to content

Commit

Permalink
updated return date format for date conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Feb 6, 2024
1 parent cc2eb46 commit cc2885c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions nepali_date_utils/date_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def convert_to_bs(self, day_data):
bs_date["year"] -= 1
bs_date["month"] = 12
bs_date["day"] = day_count
return f"{bs_date['year']}/{bs_date['month']}/{bs_date['day']}"

return bs_date
except KeyError:
raise ValueError("Date out of range")
Expand Down Expand Up @@ -122,12 +124,8 @@ def offset_ad_days(self, day_count):
self.reference_ad["day"],
)
offset_date = base_date + timedelta(days=day_count)
return offset_date.date().strftime("%Y/%m/%d")

month = offset_date.month

date_obj = {"year": offset_date.year, "month": month, "day": offset_date.day}

return date_obj

@classmethod
def ad_to_bs(cls, date_str):
Expand Down

0 comments on commit cc2885c

Please sign in to comment.