-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add fiscal year calculation methods and update README with usag…
…e examples
- Loading branch information
Showing
3 changed files
with
89 additions
and
1 deletion.
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,9 @@ | ||
|
||
def get_fiscal_year_by_date(date_obj): | ||
"""Return fiscal year by the given Nepali datetime object""" | ||
# Fiscal year starts in Shrawan (month 4) | ||
if date_obj.month < 4: # Months 1, 2, 3 are part of the previous fiscal year | ||
fiscal_year = (date_obj.year - 1, date_obj.year) | ||
else: | ||
fiscal_year = (date_obj.year, date_obj.year + 1) | ||
return fiscal_year |