π¬ Convert UTC to MENA local time with Hijri seasons and Ramadan send rules
β‘ 2 views Β· π¬ Document Extraction & Analysis
Description
Quick overview
This sub-workflow takes a UTC timestamp and MENA locale inputs and returns a typed object with local time, workweek/weekend status, Hijri (Umm al-Qura) season flags, and Ramadan-aware sendability rules including a suggested next send time.
How it works
- Receives inputs from another workflow (or a manual self-test) including
ts_utc,tz,country, andaudience. - Applies default values for missing inputs (for example Baghdad time zone, Iraq country code, and a current UTC timestamp).
- Converts the UTC timestamp to the target IANA time zone, calculates the UTC offset, determines the local weekday, and flags workdays/weekends based on a per-country weekend table.
- Computes the local day boundaries in UTC and the next workday start time to support rollups and scheduling.
- Derives the Umm al-Qura Hijri date and flags Ramadan, Eid al-Fitr, Eid al-Adha, Hajj window, and any user-provided holiday overrides.
- Classifies the local time into a daypart and evaluates whether the timestamp is inside an allowed send window (including Friday prayer blocking and Ramadan late-night rules), returning
is_sendable,block_reason, andsend_afterwhen blocked. - Outputs either a self-test report with pass/fail assertions or a flattened βcontractβ object that downstream workflows can rely on.
Setup
- In your parent workflow, add an Execute Workflow step that calls this sub-workflow and passes
ts_utc(ISO 8601),tz(IANA time zone),country(for exampleiq,sa,ae,eg), andaudience(b2corb2b). - If you need to reflect local holiday announcements (for example Eid by moon sighting), pass
holiday_overridesas an array of{ date: "YYYY-MM-DD", country: "*"|"iq"|..., name: "..." }. - Optionally run the built-in manual self-test to validate weekend rules, day boundaries, and Ramadan send-window behavior in your environment.
Requirements
- None. No credentials, no API keys, no npm packages, no external calls.
Customization
- Every country defaults to a Fri-Sat weekend except
ae, which is Sat-Sun. Edit theWEEKENDmap. Passholiday_overridesto correct Eid dates, since Umm al-Qura is astronomical while real announcements follow local moon sighting.
π Nodes Used
Execute Workflow Trigger
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File