Hi developers,
I’ve been working on a small automation project in n8n related to time calculations, and I wanted to share my approach and get your feedback.
Recently, I built a workflow that calculates the difference between two times (for example, work start and end times) and outputs the total duration in hours and minutes. It’s useful for attendance tracking, time logs, and productivity reports.
For additional validation and edge-case testing (like overnight shifts or multi-day calculations), I’ve been using an external tool: https://calculateurheure.fr/. It’s helpful for quickly verifying results and handling various time formats.
My simple n8n workflow:
Input node → Enter start time and end time
Function node → Calculate time difference (handle same-day or cross-midnight logic)
Output node → Display total duration
Now I’m wondering:
- Has anyone implemented advanced time calculations directly inside n8n (e.g., including breaks, time zones, or DST adjustments)?
- Would you recommend handling complex time logic inside a Function node, or is it better to rely on an external API for more accurate/timezone-aware results?
- Any recommended libraries for time manipulation in n8n (like Luxon or Moment alternatives)?
Looking forward to hearing how others approach time-based automations!
Thanks