package Ġcom . k iz iton wo se . calendar view . utils . pers ian Ċ Ċ import Ġorg . th reet en . bp . DayOfWeek Ċ import Ġorg . th reet en . bp . LocalDate Ċ import Ġorg . th reet en . bp . Year Month Ċ import Ġorg . th reet en . bp . Zone Offset Ċ import Ġjava . util .* Ċ Ċ fun ĠDay OfWeek . get Pers ian DisplayName (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġwhen Ġ( this . ordinal ) Ġ{ ĊĠĠĠĠĠĠĠ ĠDay OfWeek . MON DAY . ordinal Ġ-> ĠPers ian Calendar Constants . pers ian Week Days [ 2 ] ĊĠĠĠĠĠĠĠ ĠDay OfWeek . T UES DAY . ordinal Ġ-> ĠPers ian Calendar Constants . pers ian Week Days [ 3 ] ĊĠĠĠĠĠĠĠ ĠDay OfWeek . W ED N ES DAY . ordinal Ġ-> ĠPers ian Calendar Constants . pers ian Week Days [ 4 ] ĊĠĠĠĠĠĠĠ ĠDay OfWeek . TH UR SD AY . ordinal Ġ-> ĠPers ian Calendar Constants . pers ian Week Days [ 5 ] ĊĠĠĠĠĠĠĠ ĠDay OfWeek . FR ID AY . ordinal Ġ-> ĠPers ian Calendar Constants . pers ian Week Days [ 6 ] ĊĠĠĠĠĠĠĠ ĠDay OfWeek . S ATUR DAY . ordinal Ġ-> ĠPers ian Calendar Constants . pers ian Week Days [ 0 ] ĊĠĠĠĠĠĠĠ ĠDay OfWeek . S UND AY . ordinal Ġ-> ĠPers ian Calendar Constants . pers ian Week Days [ 1 ] ĊĠĠĠĠĠĠĠ Ġelse Ġ-> ĠPers ian Calendar Constants . pers ian Week Days [ 0 ] ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠDay OfWeek . get Pers ian Display First Char String (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġthis . get Pers ian DisplayName ()[ 0 ]. toString () Ċ } Ċ Ċ fun ĠLocalDate . to Pers ian Calendar (): ĠPers ian Calendar Ġ{ ĊĠĠĠ Ġreturn ĠPers ian Calendar ( at Start OfDay (). to Instant ( Zone Offset . UTC ). to Epoch Milli ()) Ċ } Ċ Ċ fun ĠYear Month . pers ian l Month Length (): ĠInt Ġ= Ġthis . at Day ( 1 ). to Pers ian Calendar (). month Length Ċ Ċ fun ĠYear Month . pers ian l Calendar () Ġ= Ġthis . at Day ( 1 ). to Pers ian Calendar () ĊĊ Ċ val ĠPers ian Calendar . month Length : ĠInt ĊĠĠĠ Ġget () Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġif Ġ( pers ian Month Ġ< Ġ 6 ) Ġ{ Ġ// ĠFar vard in Ġ... ĠSh ah riv ar ĊĠĠĠĠĠĠĠĠĠĠĠĠ 3 1 ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġif Ġ(( pers ian Month Ġin Ġ 6 .. 1 0 ) Ġ|| Ġ( is Pers ian Le ap Year Ġ&& Ġpers ian Month Ġ== Ġ 1 1 )) Ġ{ Ġ// ĠMe hr Ġ... ĠB ah man Ġand Ġle ap Ġyear ĠE sf and ĊĠĠĠĠĠĠĠĠĠĠĠĠ 3 0 ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ 2 9 Ġ// ĠNormal ĠE sf and ĊĠĠĠ Ġ} Ċ Ċ fun ĠPers ian Calendar . to LocalDate (): ĠLocalDate Ġ{ ĊĠĠĠ Ġreturn ĠLocalDate . of ( get ( Calendar . YEAR ), Ġget ( Calendar . MONTH ) Ġ+ Ġ 1 , Ġget ( Calendar . DAY _ OF _ MONTH )) Ċ } Ċ Ċ fun ĠPers ian Calendar . add Days ( days : ĠInt ): ĠPers ian Calendar Ġ{ ĊĠĠĠ Ġval Ġpers ian Calendar Ġ= ĠPers ian Calendar ( time In Millis ) ĊĠĠĠ Ġpers ian Calendar . add ( Calendar . DAY _ OF _ MONTH , Ġdays ) ĊĠĠĠ Ġreturn Ġpers ian Calendar Ċ } Ċ Ċ fun ĠPers ian Calendar . add Months ( months : ĠInt ): ĠPers ian Calendar Ġ{ ĊĠĠĠ Ġval Ġpers ian Calendar Ġ= ĠPers ian Calendar ( time In Millis ) ĊĠĠĠ Ġpers ian Calendar . add Pers ian Date ( Calendar . MONTH , Ġmonths ) ĊĠĠĠ Ġreturn Ġpers ian Calendar Ċ } Ċ Ċ fun ĠPers ian Calendar . add Years ( years : ĠInt ): ĠPers ian Calendar Ġ{ ĊĠĠĠ Ġval Ġpers ian Calendar Ġ= ĠPers ian Calendar ( time In Millis ) ĊĠĠĠ Ġpers ian Calendar . add Pers ian Date ( Calendar . YEAR , Ġyears ) ĊĠĠĠ Ġreturn Ġpers ian Calendar Ċ } Ċ Ċ fun ĠPers ian Calendar . with Day ( day : ĠInt ): ĠPers ian Calendar Ġ{ ĊĠĠĠ Ġval Ġdiff Days Ġ= Ġday Ġ- Ġpers ian Day ĊĠĠĠ Ġreturn ĠPers ian Calendar ( time In Millis ). add Days ( diff Days ) Ċ } Ċ Ċ fun ĠPers ian Calendar . with Month ( month : ĠInt ): ĠPers ian Calendar Ġ{ ĊĠĠĠ Ġval Ġdiff Months Ġ= Ġmonth Ġ- Ġpers ian Month ĊĠĠĠ Ġreturn ĠPers ian Calendar ( time In Millis ). add Months ( diff Months ) Ċ } Ċ Ċ fun ĠPers ian Calendar . with Year ( year : ĠInt ): ĠPers ian Calendar Ġ{ ĊĠĠĠ Ġval Ġdiff Years Ġ= Ġyear Ġ- Ġpers ian Year ĊĠĠĠ Ġreturn ĠPers ian Calendar ( time In Millis ). add Years ( diff Years ) Ċ } Ċ Ċ val ĠPers ian Calendar . week In Month : ĠInt ĊĠĠĠ Ġget () Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġ( pers ian Day Ġ+ ĠPers ian Calendar ( time In Millis ). with Day ( 1 ). get ( Calendar . DAY _ OF _ WEEK ) Ġ- Ġ 1 ) Ġ/ Ġ 7 ĊĠĠĠ Ġ}