1 ! Copyright (C) 2007 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays classes.tuple combinators
4 combinators.short-circuit kernel locals math math.functions
5 math.intervals math.order math.parser sequences
6 slots.syntax splitting system vocabs vocabs.loader ;
7 FROM: math.ranges => [a..b) ;
10 ERROR: not-in-interval value interval ;
12 : check-interval ( value interval -- value )
13 2dup interval-contains? [ drop ] [ not-in-interval ] if ;
15 HOOK: gmt-offset os ( -- hours minutes seconds )
17 HOOK: gmt os ( -- timestamp )
27 C: <duration> duration
29 : instant ( -- duration ) 0 0 0 0 0 0 <duration> ;
38 { gmt-offset duration } ;
40 CONSTANT: day-counts { 0 31 28 31 30 31 30 31 31 30 31 30 31 }
42 GENERIC: leap-year? ( obj -- ? )
45 dup 100 divisor? 400 4 ? divisor? ;
47 M: timestamp leap-year?
50 : (days-in-month) ( year month -- n )
51 dup 2 = [ drop leap-year? 29 28 ? ] [ nip day-counts nth ] if ;
53 :: <timestamp> ( year month day hour minute second gmt-offset -- timestamp )
55 month 1 12 [a,b] check-interval
56 day 1 year month (days-in-month) [a,b] check-interval
57 hour 0 23 [a,b] check-interval
58 minute 0 59 [a,b] check-interval
59 second 0 60 [a,b) check-interval
60 gmt-offset timestamp boa ;
62 M: timestamp clone (clone) [ clone ] change-gmt-offset ;
64 : gmt-offset-duration ( -- duration )
65 0 0 0 gmt-offset <duration> ; inline
67 : <date> ( year month day -- timestamp )
68 0 0 0 gmt-offset-duration <timestamp> ; inline
70 : <date-gmt> ( year month day -- timestamp )
71 0 0 0 instant <timestamp> ; inline
73 : <year> ( year -- timestamp )
76 : <year-gmt> ( year -- timestamp )
77 1 1 <date-gmt> ; inline
79 CONSTANT: average-month 30+5/12
80 CONSTANT: months-per-year 12
81 CONSTANT: days-per-year 3652425/10000
82 CONSTANT: hours-per-year 876582/100
83 CONSTANT: minutes-per-year 5259492/10
84 CONSTANT: seconds-per-year 31556952
86 :: julian-day-number ( year month day -- n )
87 ! Returns a composite date number
88 ! Not valid before year -4800
91 month 12 a * + 3 - :> m
93 day 153 m * 2 + 5 /i + 365 y * +
94 y 4 /i + y 100 /i - y 400 /i + 32045 - ;
96 :: julian-day-number>date ( n -- year month day )
97 ! Inverse of julian-day-number
99 4 a * 3 + 146097 /i :> b
100 a 146097 b * 4 /i - :> c
101 4 c * 3 + 1461 /i :> d
102 c 1461 d * 4 /i - :> e
103 5 e * 2 + 153 /i :> m
108 e 153 m * 2 + 5 /i - 1 + ;
110 GENERIC: easter ( obj -- obj' )
112 :: easter-month-day ( year -- month day )
114 year 100 /mod :> ( b c )
118 19 a * b + d - g - 15 + 30 mod :> h
120 32 2 e * + 2 i * + h - k - 7 mod :> l
121 a 11 h * + 22 l * + 451 /i :> m
123 h l + 7 m * - 114 + 31 /mod 1 + ;
126 dup easter-month-day <date> ;
130 dup year>> easter-month-day
131 swapd >>day swap >>month ;
133 : >date< ( timestamp -- year month day )
134 [ year>> ] [ month>> ] [ day>> ] tri ;
136 : >time< ( timestamp -- hour minute second )
137 [ hour>> ] [ minute>> ] [ second>> ] tri ;
139 : set-time! ( timestamp hours minutes seconds -- timestamp )
140 [ >>hour ] [ >>minute ] [ >>second ] tri* ;
142 : set-time ( timestamp hours minutes seconds -- timestamp )
145 : time>hms ( str -- hms-seq )
146 ":" split [ string>number ] map
149 : time>offset ( str -- hms-seq )
150 "-" ?head [ time>hms ] dip
151 [ [ neg ] map ] when ;
153 : years ( x -- duration ) instant swap >>year ;
154 : months ( x -- duration ) instant swap >>month ;
155 : days ( x -- duration ) instant swap >>day ;
156 : weeks ( x -- duration ) 7 * days ;
157 : hours ( x -- duration ) instant swap >>hour ;
158 : minutes ( x -- duration ) instant swap >>minute ;
159 : seconds ( x -- duration ) instant swap >>second ;
160 : milliseconds ( x -- duration ) 1000 / seconds ;
161 : microseconds ( x -- duration ) 1000000 / seconds ;
162 : nanoseconds ( x -- duration ) 1000000000 / seconds ;
166 GENERIC: +year ( timestamp x -- timestamp )
167 GENERIC: +month ( timestamp x -- timestamp )
168 GENERIC: +day ( timestamp x -- timestamp )
169 GENERIC: +hour ( timestamp x -- timestamp )
170 GENERIC: +minute ( timestamp x -- timestamp )
171 GENERIC: +second ( timestamp x -- timestamp )
173 : /rem ( f n -- q r )
174 ! q is positive or negative, r is positive from 0 <= r < n
175 [ / floor >integer ] 2keep rem ;
177 : float>whole-part ( float -- int float )
178 [ floor >integer ] keep over - ;
180 : adjust-leap-year ( timestamp -- timestamp )
182 { [ day>> 29 = ] [ month>> 2 = ] [ leap-year? not ] } 1&&
183 [ 3 >>month 1 >>day ] when ;
186 [ + ] curry change-year adjust-leap-year ;
189 float>whole-part swapd days-per-year * +day swap +year ;
191 : months/years ( n -- months years )
192 12 /rem [ 1 - 12 ] when-zero swap ; inline
195 over month>> + months/years [ >>month ] dip +year ;
198 float>whole-part swapd average-month * +day swap +month ;
201 over >date< julian-day-number + julian-day-number>date
202 [ >>year ] [ >>month ] [ >>day ] tri* ;
205 float>whole-part swapd 24 * +hour swap +day ;
207 : hours/days ( n -- hours days )
211 over hour>> + hours/days [ >>hour ] dip +day ;
214 float>whole-part swapd 60 * +minute swap +hour ;
216 : minutes/hours ( n -- minutes hours )
220 over minute>> + minutes/hours [ >>minute ] dip +hour ;
223 float>whole-part swapd 60 * +second swap +minute ;
225 : seconds/minutes ( n -- seconds minutes )
226 60 /rem swap >integer ;
229 over second>> + seconds/minutes [ >>second ] dip +minute ;
231 : (time+) ( timestamp duration -- timestamp' duration )
232 [ second>> +second ] keep
233 [ minute>> +minute ] keep
234 [ hour>> +hour ] keep
236 [ month>> +month ] keep
237 [ year>> +year ] keep ; inline
239 : +slots ( obj1 obj2 quot -- n obj1 obj2 )
240 [ bi@ + ] curry 2keep ; inline
244 GENERIC#: time+ 1 ( time1 time2 -- time3 )
247 [ clone ] dip (time+) drop ;
262 : duration>years ( duration -- x )
263 ! Uses average month/year length since duration loses calendar
268 [ month>> months-per-year / + ]
269 [ day>> days-per-year / + ]
270 [ hour>> hours-per-year / + ]
271 [ minute>> minutes-per-year / + ]
272 [ second>> seconds-per-year / + ]
275 M: duration <=> [ duration>years ] compare ;
277 : duration>months ( duration -- x ) duration>years months-per-year * ;
278 : duration>days ( duration -- x ) duration>years days-per-year * ;
279 : duration>hours ( duration -- x ) duration>years hours-per-year * ;
280 : duration>minutes ( duration -- x ) duration>years minutes-per-year * ;
281 : duration>seconds ( duration -- x ) duration>years seconds-per-year * ;
282 : duration>milliseconds ( duration -- x ) duration>seconds 1000 * ;
283 : duration>microseconds ( duration -- x ) duration>seconds 1000000 * ;
284 : duration>nanoseconds ( duration -- x ) duration>seconds 1000000000 * ;
286 GENERIC: time- ( time1 time2 -- time3 )
288 : convert-timezone ( timestamp duration -- timestamp' )
289 over gmt-offset>> over = [ drop ] [
290 [ over gmt-offset>> time- time+ ] keep >>gmt-offset
293 : >local-time ( timestamp -- timestamp' )
294 clone gmt-offset-duration convert-timezone ;
296 : >gmt ( timestamp -- timestamp' )
297 clone dup gmt-offset>> dup instant =
299 [ neg +second 0 ] change-second
300 [ neg +minute 0 ] change-minute
301 [ neg +hour 0 ] change-hour
302 [ neg +day 0 ] change-day
303 [ neg +month 0 ] change-month
304 [ neg +year 0 ] change-year drop
307 M: timestamp <=> [ >gmt tuple-slots ] compare ;
309 : same-year? ( ts1 ts2 -- ? )
310 [ >gmt slots{ year } ] same? ;
312 : quarter ( timestamp -- [1,4] )
313 month>> 3 /mod [ drop 1 + ] unless-zero ; inline
315 : same-quarter? ( ts1 ts2 -- ? )
316 [ >gmt [ year>> ] [ quarter ] bi 2array ] same? ;
318 : same-month? ( ts1 ts2 -- ? )
319 [ >gmt slots{ year month } ] same? ;
321 :: (day-of-year) ( year month day -- n )
322 day-counts month head-slice sum day +
324 year month day <date>
329 : day-of-year ( timestamp -- n )
330 >date< (day-of-year) ;
332 : same-day? ( ts1 ts2 -- ? )
333 [ >gmt slots{ year month day } ] same? ;
335 : zeller-congruence ( year month day -- n )
337 ! http://web.textfiles.com/computers/formulas.txt
338 ! good for any date since October 15, 1582
340 dup 2 <= [ [ 1 - ] [ 12 + ] bi* ] when
341 [ dup [ 4 /i + ] [ 100 /i - ] [ 400 /i + ] tri ] dip
342 [ 1 + 3 * 5 /i + ] keep 2 * +
345 : day-of-week ( timestamp -- n )
346 >date< zeller-congruence ;
348 : (week-number) ( timestamp -- [0,53] )
349 [ day-of-year ] [ day-of-week [ 7 ] when-zero ] bi - 10 + 7 /i ;
352 : week-number ( timestamp -- [1,53] )
354 { 0 [ year>> 1 - end-of-year (week-number) ] }
355 { 53 [ year>> 1 + <year> (week-number) 1 = 1 53 ? ] }
359 : same-week? ( ts1 ts2 -- ? )
360 [ >gmt [ year>> ] [ week-number ] bi 2array ] same? ;
362 : same-hour? ( ts1 ts2 -- ? )
363 [ >gmt slots{ year month day hour } ] same? ;
365 : same-minute? ( ts1 ts2 -- ? )
366 [ >gmt slots{ year month day hour minute } ] same? ;
368 : same-second? ( ts1 ts2 -- ? )
369 [ >gmt slots{ year month day hour minute second } ] same? ;
371 : (time-) ( timestamp timestamp -- n )
373 [ [ >date< julian-day-number ] bi@ - 86400 * ] 2keep
374 [ >time< [ [ 3600 * ] [ 60 * ] bi* ] dip + + ] bi@ - + ;
377 ! Exact calendar-time difference
380 : time* ( obj1 obj2 -- obj3 )
381 dup real? [ swap ] when
393 : before ( duration -- -duration )
398 : -slots ( obj1 obj2 quot -- n obj1 obj2 )
399 [ bi@ - ] curry 2keep ; inline
416 : unix-1970 ( -- timestamp )
417 1970 <year-gmt> ; inline
419 : millis>timestamp ( x -- timestamp )
420 [ unix-1970 ] dip 1000 / +second ;
422 : timestamp>millis ( timestamp -- n )
423 unix-1970 (time-) 1000 * >integer ;
425 : micros>timestamp ( x -- timestamp )
426 [ unix-1970 ] dip 1000000 / +second ;
428 : timestamp>micros ( timestamp -- n )
429 unix-1970 (time-) 1000000 * >integer ;
431 : now ( -- timestamp )
432 gmt gmt-offset-duration (time+) >>gmt-offset ;
434 : hence ( duration -- timestamp ) now swap time+ ;
436 : ago ( duration -- timestamp ) now swap time- ;
438 GENERIC: days-in-year ( obj -- n )
440 M: integer days-in-year leap-year? 366 365 ? ;
442 M: timestamp days-in-year year>> days-in-year ;
444 : days-in-month ( timestamp -- n )
445 >date< drop (days-in-month) ;
447 : midnight! ( timestamp -- new-timestamp )
448 0 >>hour 0 >>minute 0 >>second ; inline
450 : midnight ( timestamp -- new-timestamp )
451 clone midnight! ; inline
453 : noon ( timestamp -- new-timestamp )
454 midnight 12 >>hour ; inline
456 : today ( -- timestamp )
457 now midnight! ; inline
459 : tomorrow ( -- timestamp )
460 1 days hence midnight! ; inline
462 : yesterday ( -- timestamp )
463 1 days ago midnight! ; inline
465 GENERIC: start-of-day ( object -- new-timestamp )
466 M: timestamp start-of-day midnight ;
468 : end-of-day! ( timestamp -- timestamp )
469 23 >>hour 59 >>minute 59+999/1000 >>second ;
471 GENERIC: end-of-day ( object -- new-timestamp )
472 M: timestamp end-of-day clone end-of-day! ;
474 : start-of-month ( timestamp -- new-timestamp )
475 midnight 1 >>day ; inline
477 : end-of-month ( timestamp -- new-timestamp )
478 [ end-of-day ] [ days-in-month ] bi >>day ;
480 : start-of-quarter ( timestamp -- new-timestamp )
481 [ start-of-day ] [ quarter 1 - 3 * ] bi >>month ; inline
483 : end-of-quarter ( timestamp -- new-timestamp )
484 [ clone ] [ quarter 1 - 3 * 3 + ] bi >>month end-of-month ; inline
486 GENERIC: start-of-year ( object -- new-timestamp )
487 M: timestamp start-of-year start-of-month 1 >>month ;
488 M: integer start-of-year <year> ;
490 GENERIC: end-of-year ( object -- new-timestamp )
491 M: timestamp end-of-year end-of-day 12 >>month 31 >>day ;
492 M: integer end-of-year 12 31 <date> end-of-day! ;
494 GENERIC: start-of-decade ( object -- new-timestamp )
495 M: timestamp start-of-decade start-of-year [ dup 10 mod - ] change-year ;
496 M: integer start-of-decade start-of-year [ dup 10 mod - ] change-year ;
498 GENERIC: end-of-decade ( object -- new-timestamp )
499 M: timestamp end-of-decade end-of-year [ dup 10 mod - 9 + ] change-year ;
500 M: integer end-of-decade end-of-year [ dup 10 mod - 9 + ] change-year ;
502 : last-day-of-decade ( object -- new-timestamp )
503 end-of-decade end-of-decade midnight ;
505 : last-day-of-year ( object -- new-timestamp )
506 end-of-year midnight ;
508 : start-of-hour ( timestamp -- new-timestamp ) clone 0 >>minute 0 >>second ;
509 : end-of-hour ( timestamp -- new-timestamp ) clone 59 >>minute 59+999/1000 >>second ;
511 : start-of-minute ( timestamp -- new-timestamp ) clone 0 >>second ;
512 : end-of-minute ( timestamp -- new-timestamp ) clone 59+999/1000 >>second ;
514 GENERIC: start-of-second ( object -- new-timestamp )
515 M: timestamp start-of-second clone [ floor ] change-second ;
516 M: real start-of-second floor ;
518 GENERIC: end-of-second ( object -- new-timestamp )
519 M: timestamp end-of-second clone [ floor 999/1000 + ] change-second ;
520 M: real end-of-second floor 999/1000 + ;
524 : day-offset ( timestamp m -- new-timestamp n )
525 over day-of-week - ; inline
527 : day-this-week ( timestamp n -- new-timestamp )
528 day-offset days time+ ;
530 :: nth-day-this-month ( timestamp n day -- new-timestamp )
531 timestamp start-of-month day day-this-week
532 dup timestamp [ month>> ] same? [ 1 weeks time+ ] unless ;
534 : last-day-this-month ( timestamp day -- new-timestamp )
535 [ 1 months time+ 1 ] dip nth-day-this-month 1 weeks time- ;
539 GENERIC: january ( obj -- timestamp )
540 GENERIC: february ( obj -- timestamp )
541 GENERIC: march ( obj -- timestamp )
542 GENERIC: april ( obj -- timestamp )
543 GENERIC: may ( obj -- timestamp )
544 GENERIC: june ( obj -- timestamp )
545 GENERIC: july ( obj -- timestamp )
546 GENERIC: august ( obj -- timestamp )
547 GENERIC: september ( obj -- timestamp )
548 GENERIC: october ( obj -- timestamp )
549 GENERIC: november ( obj -- timestamp )
550 GENERIC: december ( obj -- timestamp )
552 M: integer january 1 1 <date> ;
553 M: integer february 2 1 <date> ;
554 M: integer march 3 1 <date> ;
555 M: integer april 4 1 <date> ;
556 M: integer may 5 1 <date> ;
557 M: integer june 6 1 <date> ;
558 M: integer july 7 1 <date> ;
559 M: integer august 8 1 <date> ;
560 M: integer september 9 1 <date> ;
561 M: integer october 10 1 <date> ;
562 M: integer november 11 1 <date> ;
563 M: integer december 12 1 <date> ;
565 M: timestamp january clone 1 >>month ;
566 M: timestamp february clone 2 >>month ;
567 M: timestamp march clone 3 >>month ;
568 M: timestamp april clone 4 >>month ;
569 M: timestamp may clone 5 >>month ;
570 M: timestamp june clone 6 >>month ;
571 M: timestamp july clone 7 >>month ;
572 M: timestamp august clone 8 >>month ;
573 M: timestamp september clone 9 >>month ;
574 M: timestamp october clone 10 >>month ;
575 M: timestamp november clone 11 >>month ;
576 M: timestamp december clone 12 >>month ;
578 : <january> ( year day -- timestamp ) 1 swap <date> ; inline
579 : <february> ( year day -- timestamp ) 2 swap <date> ; inline
580 : <march> ( year day -- timestamp ) 3 swap <date> ; inline
581 : <april> ( year day -- timestamp ) 4 swap <date> ; inline
582 : <may> ( year day -- timestamp ) 5 swap <date> ; inline
583 : <june> ( year day -- timestamp ) 6 swap <date> ; inline
584 : <july> ( year day -- timestamp ) 7 swap <date> ; inline
585 : <august> ( year day -- timestamp ) 8 swap <date> ; inline
586 : <september> ( year day -- timestamp ) 9 swap <date> ; inline
587 : <october> ( year day -- timestamp ) 10 swap <date> ; inline
588 : <november> ( year day -- timestamp ) 11 swap <date> ; inline
589 : <december> ( year day -- timestamp ) 12 swap <date> ; inline
591 : sunday ( timestamp -- new-timestamp ) 0 day-this-week ;
592 : monday ( timestamp -- new-timestamp ) 1 day-this-week ;
593 : tuesday ( timestamp -- new-timestamp ) 2 day-this-week ;
594 : wednesday ( timestamp -- new-timestamp ) 3 day-this-week ;
595 : thursday ( timestamp -- new-timestamp ) 4 day-this-week ;
596 : friday ( timestamp -- new-timestamp ) 5 day-this-week ;
597 : saturday ( timestamp -- new-timestamp ) 6 day-this-week ;
599 : sunday? ( timestamp -- ? ) day-of-week 0 = ;
600 : monday? ( timestamp -- ? ) day-of-week 1 = ;
601 : tuesday? ( timestamp -- ? ) day-of-week 2 = ;
602 : wednesday? ( timestamp -- ? ) day-of-week 3 = ;
603 : thursday? ( timestamp -- ? ) day-of-week 4 = ;
604 : friday? ( timestamp -- ? ) day-of-week 5 = ;
605 : saturday? ( timestamp -- ? ) day-of-week 6 = ;
607 GENERIC: weekend? ( obj -- ? )
608 M: timestamp weekend? day-of-week weekend? ;
609 M: integer weekend? { 0 6 } member? ;
611 GENERIC: weekday? ( obj -- ? )
612 M: timestamp weekday? day-of-week weekday? ;
613 M: integer weekday? weekend? not ;
615 : same-or-next-business-day ( timestamp -- timestamp' )
618 { 6 [ 2 days time+ ] }
622 : same-or-previous-business-day ( timestamp -- timestamp' )
624 { 0 [ 2 days time- ] }
629 : weekdays-between ( date1 date2 -- n )
631 [ swap time- duration>days 5 * ]
632 [ [ day-of-week ] bi@ - 2 * ] 2bi - 7 /i 1 +
634 day-of-week 6 = [ [ 1 - ] dip ] when
635 day-of-week 0 = [ 1 - ] when ;
637 CONSTANT: weekday-offsets { 0 0 1 2 3 4 5 }
639 : weekdays-between2 ( date1 date2 -- n )
640 [ swap time- duration>days 1 + ]
641 [ [ day-of-week ] bi@ 6 swap - ] 2bi
644 [ [ weekday-offsets nth ] bi@ + ] 2bi - ;
647 : sunday-of-month ( timestamp n -- new-timestamp ) 0 nth-day-this-month ;
648 : monday-of-month ( timestamp n -- new-timestamp ) 1 nth-day-this-month ;
649 : tuesday-of-month ( timestamp n -- new-timestamp ) 2 nth-day-this-month ;
650 : wednesday-of-month ( timestamp n -- new-timestamp ) 3 nth-day-this-month ;
651 : thursday-of-month ( timestamp n -- new-timestamp ) 4 nth-day-this-month ;
652 : friday-of-month ( timestamp n -- new-timestamp ) 5 nth-day-this-month ;
653 : saturday-of-month ( timestamp n -- new-timestamp ) 6 nth-day-this-month ;
655 : last-sunday-of-month ( timestamp -- new-timestamp ) 0 last-day-this-month ;
656 : last-monday-of-month ( timestamp -- new-timestamp ) 1 last-day-this-month ;
657 : last-tuesday-of-month ( timestamp -- new-timestamp ) 2 last-day-this-month ;
658 : last-wednesday-of-month ( timestamp -- new-timestamp ) 3 last-day-this-month ;
659 : last-thursday-of-month ( timestamp -- new-timestamp ) 4 last-day-this-month ;
660 : last-friday-of-month ( timestamp -- new-timestamp ) 5 last-day-this-month ;
661 : last-saturday-of-month ( timestamp -- new-timestamp ) 6 last-day-this-month ;
663 : start-of-week ( timestamp -- new-timestamp )
666 : o'clock ( timestamp n -- new-timestamp )
667 [ midnight ] dip >>hour ;
669 : am ( timestamp n -- new-timestamp )
670 0 12 [a,b] check-interval o'clock ;
672 : pm ( timestamp n -- new-timestamp )
673 0 12 [a,b] check-interval 12 + o'clock ;
675 : time-since-midnight ( timestamp -- duration )
676 dup midnight time- ; inline
678 : since-1970 ( duration -- timestamp )
679 unix-1970 time+ ; inline
681 : timestamp>unix-time ( timestamp -- seconds )
682 unix-1970 (time-) ; inline
684 : unix-time>timestamp ( seconds -- timestamp )
685 [ unix-1970 ] dip +second ; inline
687 ! January and February need a fixup with this algorithm.
688 ! Find a better algorithm.
689 : ymd>ordinal ( year month day -- ordinal )
690 [ leap-year? dup -2 -3 ? ]
691 [ dup 3 < [ 12 + ] when [ 1 - 30 * ] [ 1 + .6 * floor ] bi + ]
692 [ ] tri* + + >integer
695 : timestamp>year-dates ( timestamp -- seq )
696 [ start-of-year >date< julian-day-number ]
699 [a..b) [ julian-day-number>date <date> ] map ;
701 : year-ordinal>timestamp ( year ordinal -- timestamp )
702 [ 1 1 julian-day-number ] dip
703 + 1 - julian-day-number>date <date> ;
705 GENERIC: weeks-in-week-year ( obj -- n )
706 M: integer weeks-in-week-year
707 { [ 1 1 <date> thursday? ] [ 12 31 <date> thursday? ] } 1|| 53 52 ? ;
709 M: timestamp weeks-in-week-year
710 { [ january 1 >>day thursday? ] [ december 31 >>day thursday? ] } 1|| 53 52 ? ;
713 { [ os unix? ] [ "calendar.unix" ] }
714 { [ os windows? ] [ "calendar.windows" ] }
717 { "threads" "calendar" } "calendar.threads" require-when