Skip to content

Monthly recurring expenses at local midnight are dated as previous day due to timezone conversion #703

Description

@ZenoBell

Description

Monthly recurring expenses scheduled at local midnight can be created with the previous calendar date.

For example, I created a recurring bill on May 29, 2026 and configured it to recur at 00:00 on day 1 of each month.

The June occurrence appeared correctly on June 1, but the next occurrence appeared as June 30 instead of July 1.

Expected behavior

A recurring expense configured as:

0 0 1 * *

should create the monthly expense dated July 1, August 1, etc. in the user's local timezone.

Actual behavior

The July occurrence appears dated June 30.

Suspected cause

The app converts the frontend cron expression to backend/UTC time before storing it for pg_cron. In Europe/Vienna during summer time, July 1 00:00 local is June 30 22:00 UTC.

The recurrence job then duplicates the expense using database now() as the new expenseDate, so the generated expense can inherit the UTC previous-day date instead of the intended local recurrence date.

Relevant code appears to be:

  • src/lib/cron.ts
  • duplicate_expense_with_participants in the recurrence migration/function

Environment

  • Timezone: Europe/Vienna
  • Schedule: monthly, day 1, 00:00
  • Example occurrence: expected July 1, 2026, shown as June 30, 2026

Recommended Fix Direction
The app should not use raw database now() as the logical expense date for recurring expenses. It should calculate/store the intended recurrence date in the user’s local timezone, or run pg_cron with timezone-aware scheduling if supported by the deployed PostgreSQL/pg_cron version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions