How to find if the previous day is a holiday or not?

Hello everyone :slight_smile:

I’m looking for tips regarding holidays:

The robot need to check emails based on two criterias:

  • if we are Monday, save mails from monday and saturday
  • if we are any other week day, check if yesterday was a holiday and if so, save mails from today and yesterday.

For the first one I’m good, but for the holiday I need some help !

The only way I’ve found is to create a list of all of them and check it.
But it’s really not optimal.

Any feedback is welcome,

Thanks in adavance.

@ppr , you always have an interesting approach so I tag you :slight_smile:

Holidays are not part of the .Net Api. So we have to take care extra about this.

Implementations using a list are common, when such a part is modelled. It also depends to your more detail requirements e.g. different holidays of substates for a country etc.

looking to the requirement:

we would recommend also to specify the case:
today any weekday except monday, but yestrday was no holiday

You could make a list of holiday dates and put them into an asset, then use that asset in your automation. Most holidays are simple, though - 1/1, 7/4, etc.

The tricky ones are Thanksgiving - you’d have to calculate if it’s the fourth Thursday of the month.

Easter? Basically impossible to calculate unless you’ve also got a Moon phase chart available to read.

In the end, making a list of holidays for the current year and updating it every year is about the only reliable solution I’ve ever seen. Of course, you could make your asset contain every holiday date for the next 50 years if you wanted, then never have to touch it again.

Thanks for answering Peter, I guess I’ll make a list then :slight_smile:

Have a nice day.

Thanks Paul for answering,

All leads lead to this method.

Fortunately I don’t have to worry about Thanksgiving :stuck_out_tongue:

I’ve found an official website which allow to enter the year you want and you can have all the holiday in a json.

Have a nice day

@Geoffroy_Pantegnies

we would suggest following:

  • focus on the email list and its creation / retrieval

Have a check on:

  • a list of holidays of the year
  • a calculation on dates incorporating the holiday list
    could have as a result which can be used for email filter when retrieving the emails e.g. get Mail XX activity (XX-Outlook, Exchange…)

So we have a chance to retrieve only the relevant emails. Maybe this helps.

Indeed it helps, thanks for your time.

I’ve found a holiday list for the next five years so it’s a good start !

Have a nice day

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