tt_NEXTWDAY function
dynamic
tt_NEXTWDAY(
- dynamic v1,
- dynamic v2
tt_NEXTWDAY(date, dow): finds the next occurrence of the given weekday from date (dow=1 Mon..7 Sun)
Implementation
dynamic tt_NEXTWDAY(dynamic v1, dynamic v2) {
final d = _vToDateTime(v1);
if (d == null) return null;
final target = varToInt(v2);
var diff = target - d.weekday;
if (diff <= 0) diff += 7;
return d.add(Duration(days: diff));
}