[personal profile] blocknote
 <<set $month to 2>>
<<set $year to 2024>>
<<if $month is 2>>
  <<if (($year % 4 is 0) and ($year % 100 is not 0)) or ($year % 400 is 0)>>
    <<set $daysInMonth to 29>>
  <<else>>
    <<set $daysInMonth to 28>>
  <</if>>
<<else>>
  <<set $daysInMonth to [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][$month - 1]>>
<</if>>
В феврале $year года $daysInMonth дней.


Прав был гражданин, который говорил, что исправлять проще, чем что-то самому сообразить, имея в голове только опилки....
 

как то так наверное: 

<<if $month === 1>>

  <<if (($year % 4 is 0) and ($year % 100 is not 0)) or ($year % 400 is 0)>>

    <<set $daysInMonth to 29>>

  <<else>>

    <<set $daysInMonth to 28>>

  <</if>>
но проверять и радоваться буду уже завтра

 


(will be screened)
(will be screened)
(will be screened)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

blocknote

September 2025

S M T W T F S
 123456
78910111213
14151617181920
21222324 252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Powered by Dreamwidth Studios