If statement - Business Hours (7am - 6pm)

N8N Selfhosted Docker: 1.61.0

Question on this if statement which is failing

Attempting to create a Business Hours If statement and/or Router

Problem - keeps failing no matter the time

2 Clauses
Clause one - After 7am
{{new Date().getHours()}} is Larger or Equal to 7
Clause two - Before 6pm
{{new Date().getHours()}} is Smaller than 7

  • n8n version: 1.61
  • Database (default: SQLite): Postgresql
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Sorted with a new expression
{{ new Intl.DateTimeFormat(‘en-AU’, { timeZone: ‘Australia/Melbourne’, hour: ‘numeric’, hour12: false }).format(new Date()) }}

2 Likes

Thank you !

for those who are looking into this - please pay extra attention to the quote being used, in @Dwayne_Taylor example I’m unsure if it’s due to the Location or the Forum but the quote used are backtick (`)

you need to replace it with normal single quote to get it working ’

Thank you :slight_smile:

1 Like

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