First day of the week is not effecting formula


I’m trying to use the Workday formula like this:

and set the first day of the week to be Sunday as such:

However, the formula exclude Saturdays and Sundays instead of Fridays and Saturdays.

Can anyone figure it out?

hi @Gal_Malul

in case you want to work with other days than the USA workday interpretation, you’d better exclude the dates that do not fit your weekend logic. something like this and you can also exclude vacations

sequence(start, end).filter(currentvalue.weekday().contains(6,7).Not())

cheers, Christiaan

Thanks Chritiaan!
However, I would actually like (as the Workday formula supposed to) to calculate an end date counting X working days from a start date, working days being Sunday to Thursday.

Shouldn’t the Workday formula be able to calculate that if the document’s first day of the week is set to Sunday?

hi @Gal_Malul ,

nope, the Coda documentation tell us that it only deals with the USA interpretation of a working week. I already suggested to update this function to cover a diverse cultural context. Maybe you can suggest it as well :wink:

You need to write your own function for this like the one below

the other tricky part in any coda set up is the weekday() logic. My default value is Monday as the first day of the week, thus the IsoWeekday(), In the coda realm one function can output two outcomes, based on a setting. I hope they fix this sooner than later, it is a quirk. To avoid this, you can use WeekdayName() and filter on this instead of the number related to weekdays.

Enjoy your second day of the working week, mine just got started. Christiaan

ps. maybe easier to read :arrow_heading_down:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.