[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>>
но проверять и радоваться буду уже завтра

 


Profile

blocknote

January 2025

S M T W T F S
    1234
567891011
12131415 161718
19202122232425
2627 28293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Powered by Dreamwidth Studios