Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
This commit is contained in:
commit
783095a100
1 changed files with 6 additions and 2 deletions
|
|
@ -211,7 +211,9 @@ proc initInterval*(miliseconds, seconds, minutes, hours, days, months,
|
||||||
result.months = months
|
result.months = months
|
||||||
result.years = years
|
result.years = years
|
||||||
|
|
||||||
proc isLeapYear(year: int): bool =
|
proc isLeapYear*(year: int): bool =
|
||||||
|
## returns true if ``year`` is a leap year
|
||||||
|
|
||||||
if year mod 400 == 0:
|
if year mod 400 == 0:
|
||||||
return true
|
return true
|
||||||
elif year mod 100 == 0:
|
elif year mod 100 == 0:
|
||||||
|
|
@ -221,7 +223,9 @@ proc isLeapYear(year: int): bool =
|
||||||
else:
|
else:
|
||||||
return false
|
return false
|
||||||
|
|
||||||
proc getDaysInMonth(month: TMonth, year: int): int =
|
proc getDaysInMonth*(month: TMonth, year: int): int =
|
||||||
|
## gets the amount of days in a ``month`` of a ``year``
|
||||||
|
|
||||||
# http://www.dispersiondesign.com/articles/time/number_of_days_in_a_month
|
# http://www.dispersiondesign.com/articles/time/number_of_days_in_a_month
|
||||||
case month
|
case month
|
||||||
of mFeb: result = if isLeapYear(year): 29 else: 28
|
of mFeb: result = if isLeapYear(year): 29 else: 28
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue