I’m a teacher and I use similar lessons year after year. It’s useful to visualize upcoming lessons by date. The lessons are ordered by instructional days, and every year they have the dates have to be adjusted.
What I wanted was to create a formula to convert the series information into dates. I figured it out and thought someone else might find it useful.
No reason to fix a thing that ain’t broke. I just want you know about a few simplifications Bases formulas let you make. For your future base building.
Using + with a string automatically stringifies the other operand, so no need to use .toString() in those cases.
You can do all of your mathematical operations together then tag a “d” at the end to make a single duration.
Seeing what you successfully figured out makes me think you probably did think to combine the math but may have run into issues. If so, then the secret sauce is in the parenthetical groups. The goal is “date + duration”, and duration is “number and unit”, and number is “a bunch of calculation”, so the grouping breakdown is “date + (( a bunch of calculation ) + unit )”.
An ungrouped “date + a bunch of calculation + unit” will fail because—coming full circle here—the + operations turn the first two operands into strings.
Thanks for the feedback. The inefficiency comes from a combination of not being fluent with the syntax behavior and the fact I tacked the weekend skipping after the fact.