Workday Binary Sensor Add Holidays in non US config

Hi,
in https://www.home-assistant.io/integrations/workday/ is a small error:
Instead of

‘add_holidays
(list)(Optional)
Add custom holidays (such as company, personal holidays or vacations). Needs to formatted as YYYY-MM-DD.’
You should mention if your not in the US but in Germany and your config starts like
’ - platform: workday
country: DE’

You need to use -‘DD-MM-YYYY’ instead of YYYY-MM-DD
eg

  • ‘25-12-2019’

The date is passed into the holidays pypi project un-doctored. It accepts any date format. So either of those will work.

Pulled from pypi doc:

# The Holiday class will also recognize strings of any format
# and int/float representing a Unix timestamp
'2014-01-01' in us_holidays  # True
'1/1/2014' in us_holidays    # True
1388597445 in us_holidays    # True
1 Like

Petro, if fed 4/7/2020 then there is ambiguity dd/mm or mm/dd leading zero’s or not.
(I don’t use this component so not that concerned but for the sake of clarity)?

No, it knows your region, no ambiguity. It follows the format of your datetime object.

1 Like

Thank you for the clarification :+1:

Hi Petro,

but i am NOT in the US :wink:
your code works (in the US) but not somewhere else.
Thats the whole point of my post.

Just change your country in the config to DE and add a 2019-12-23 as holiday and restart Homeassistent.
Now change Country back to whatever it was and restar Homeassistent.
See the difference.

Because that’s the US standard…

EDIT:
It’s implied that you use your own date format… I.E. if your OS is set to a date standard, use that standard.

yours would be day month year or year month day.

???
Please read my Post again.
“Needs to formatted as YYYY-MM-DD.”

Not a single line (depends on Country standard)
ok?!

I read your post and what you aren’t understanding is that the format is correct for the US if the OS is set to the US. I’m assuming you have your country set properly everywhere (even in your os), therefor your date is formatted differently.

Just for further clarification… It should follow the format you see displayed in your UI, because that’s the true format. Which can’t really be captured in the documentation.

Thx,
since i am new and cant (or dont know how to) change the dokumention that post may in the wrong corner
Someone who can fix the dokumention should change it.
Have a nice time alltogether.

What you don’t understand is that the documentation works for people who set the PI to be english-US. So the example is actually correct in that regard.

Just because your country is set to DE for that integration does not mean the date format will match it. It’s based on the OS.

The documentation can be cleared up for that, but its not wrong in all instances.

@Petro:
Please take a look here:

Did you see what i see ?

“Which can’t really be captured in the documentation”.
Did you see the warning above there is already a lot of captured hints?

If your pi is set up for english in the us, this is correct if you want the DE holidays:

binary_sensor:
  - platform: workday
    country: DE
    workdays: [mon, wed, fri]
    excludes: [sat, sun, holiday]
    add_holidays:
      - '2018-12-26'
      - '2018-12-31'

If you’re set up for a non-english-us, this is correct:

binary_sensor:
  - platform: workday
    country: DE
    workdays: [mon, wed, fri]
    excludes: [sat, sun, holiday]
    add_holidays:
      - '2018-26-12'
      - '2018-31-12'

Do you understand now?

Are you some kind of boring Troll?

No, I’m trying to make you understand the issue. But you aren’t understanding it, instead arguing.

sorry
you cant make me understand something i already understood
And because of i already understood i just opened this Thread for others who could use my information to change their config or change the doku.

I understand, but you still don’t seem to understand the difference between the configuration of the integration and the configuration of your operating system.

no its not
btw: there is no difference between your example 1 and 2.
So it seems you really dont know nothing more than me.

If your OS is set to English-US, ALL date formats everywhere will be MM-DD-YYYY or YYYY-MM-DD. Even with the platform set to DE.