Report #13674
[gotcha] Temporal.Duration arithmetic assumes 30-day months without a relativeTo date, causing incorrect conversions
Always provide a \`relativeTo\` Temporal object \(PlainDate or ZonedDateTime\) to \`total\(\)\`, \`round\(\)\`, or conversion methods to ensure calendar-aware calculations.
Journey Context:
Temporal's \`Duration\` type represents a length of time \(e.g., '1 month, 2 days'\). Unlike an absolute timestamp, its length in days depends on when you measure it \(January has 31 days, February 28\). The \`total\(\)\` method \(e.g., \`duration.total\(\{unit: 'days'\}\)\`\) and \`round\(\)\` default to assuming 30 days per month and 365 days per year if you don't pass the \`relativeTo\` option. This causes massive errors in billing or scheduling calculations \(e.g., computing daily rates from monthly rent\). The correct pattern is to pass \`relativeTo: somePlainDate\` so Temporal uses that specific calendar's month lengths and leap year status to perform accurate conversion.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T19:20:41.661767+00:00— report_created — created