NinjaCal_Basic
- Code: Select all
// focus month is centered on the first grid
Let ( [
isMondayStart = 3 ; // <- 0 = Sun, 1 = Monday, 2 = Tues...
// ----------------- do not change anything below ----------------
// our base display date
$$__NinjaCalBaseDate =
Case ( GetAsBoolean( $$__NinjaCalBaseDate ) ;
$$__NinjaCalBaseDate ;
Let ( $$__NinjaCalBaseDate = Get(CurrentDate) ; $$__NinjaCalBaseDate )
) ;
//base date components to handle multiple cal grids
baseM = Month ( $$__NinjaCalBaseDate ) ;
baseD = Day ($$__NinjaCalBaseDate ) ;
baseY = Year ($$__NinjaCalBaseDate ) ;
R = Get ( CalculationRepetitionNumber ) ; // the current repetition, starts at "1" ;
N = If ( Mod ( R ; 42 ) = 0 ; 42 ; Mod ( R ; 42 ) ) ; // R normalized to 42 days for each cell in a 42 grid cal
Moffset = Ceiling ( R/42) - 1 ; // month offset for each additional cal grid set
firstDateOfMo = Date ( Month( $$__NinjaCalBaseDate ) + Moffset ; 1 ; Year ( $$__NinjaCalBaseDate ));
// firstDateOfMo will always be cal date 1/mm/yyyy where mm is governed by grid offset
dayOfWkFirstDate = DayOfWeek ( firstDateOfMo ) - isMondayStart ; // tells us which week day 1/mm/yyyy is
startDate = firstDateOfMo - dayOfWkFirstDate ;
dispDate = Case (
isMondayStart >= 1 ;
Case ( dayOfWkFirstDate <= 0 ; startDate + N -7 ; startDate + N ) ;
startDate +N
)
] ;
// output
Case (
R ≥ 1000; Date ( baseM + Mod ( R; 1000 ) ; BaseD ; BaseY ) ; // repetitions greater than 1000 are used as grid month Displays
dispDate
)
)
NinjaCal_triple
- Code: Select all
// shifted left one month
Let ( [
isMondayStart = 3 ; // <<- change this value to 0 for sunday, 1 for monday, 2 for tuesday, etc.
// ----------------- do not change anything below ----------------
// our base display date
$$__NinjaCalBaseDate =
Case ( GetAsBoolean( $$__NinjaCalBaseDate ) ;
$$__NinjaCalBaseDate ;
Let ( $$__NinjaCalBaseDate = Get(CurrentDate) ; $$__NinjaCalBaseDate )
) ;
//base date components to handle multiple cal grids
baseM = Month ( $$__NinjaCalBaseDate ) ;
baseD = Day ($$__NinjaCalBaseDate ) ;
baseY = Year ($$__NinjaCalBaseDate ) ;
R = Get ( CalculationRepetitionNumber ) ; // the current repetition, starts at "1" ;
N = If ( Mod ( R ; 42 ) = 0 ; 42 ; Mod ( R ; 42 ) ) ; // R normalized to 42 days for each cell in a 42 grid cal
Moffset = Ceiling ( R/42) - 2 ; // month offset shifted left one so that 2nd grid is focus
firstDateOfMo = Date ( Month( $$__NinjaCalBaseDate ) + Moffset ; 1 ; Year ( $$__NinjaCalBaseDate ));
// firstDateOfMo will always be cal date 1/mm/yyyy where mm is governed by grid offset
dayOfWkFirstDate = DayOfWeek ( firstDateOfMo ) - isMondayStart ; // tells us which week day 1/mm/yyyy is
startDate = firstDateOfMo - dayOfWkFirstDate ;
dispDate = Case (
isMondayStart >= 1 ;
Case ( dayOfWkFirstDate <= 0 ; startDate + N -7 ; startDate + N ) ;
startDate +N
)
] ;
// output
Case (
R ≥ 1000; Date ( baseM-1 + Mod ( R; 1000 ) ; BaseD ; BaseY ) ; // repetitions greater than 1000 are used as grid month Displays
dispDate
)
)