Skip to content

Commit

Permalink
calendar: removing weekdays-between2
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Apr 13, 2023
1 parent 153cde1 commit 910e2d7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
12 changes: 0 additions & 12 deletions basis/calendar/calendar-tests.factor
Original file line number Diff line number Diff line change
Expand Up @@ -314,18 +314,6 @@ IN: calendar
dup 1 tail swap v- [ 1 <= ] all?
] unit-test

{ 0 } [
2014 1 1 <date-gmt>
2014 <year-gmt> timestamp>year-dates-gmt
[ weekdays-between2 ] with map

2014 1 1 <date-gmt>
2014 <year-gmt> timestamp>year-dates-gmt
[ weekdays-between ] with map

v- sum
] unit-test

{
{
T{ timestamp { year 2020 } { month 3 } { day 1 } }
Expand Down
9 changes: 0 additions & 9 deletions basis/calendar/calendar.factor
Original file line number Diff line number Diff line change
Expand Up @@ -762,15 +762,6 @@ ALIAS: last-day-of-week saturday
day-of-week 6 = [ [ 1 - ] dip ] when
day-of-week 0 = [ 1 - ] when ;

CONSTANT: weekday-offsets { 0 0 1 2 3 4 5 }

: weekdays-between2 ( date1 date2 -- n )
[ swap time- duration>days 1 + ]
[ [ day-of-week ] bi@ 6 swap - ] 2bi

[ + + 1.4 /i ]
[ [ weekday-offsets nth ] bi@ + ] 2bi - ;

: sunday-of-month ( timestamp n -- timestamp' ) 0 nth-day-this-month ;
: monday-of-month ( timestamp n -- timestamp' ) 1 nth-day-this-month ;
: tuesday-of-month ( timestamp n -- timestamp' ) 2 nth-day-this-month ;
Expand Down

0 comments on commit 910e2d7

Please sign in to comment.