Skip to content

Recurring Invoices created with "yesterday's" date when timezone is UTC++ #491

@semiligneous

Description

@semiligneous

Issue filing prerequisites

  • I've checked the documentation.
  • I've looked for similar issues both Open and Closed.
  • I've tried clearing both cache and cookies in my browser or tried opening the app in the Incognito/InPrivate window.

Describe the bug

Using Invoiceshelf via Docker. On most recent version 2.1.1.

I am based in Australia and have my timezone set in compose:

      - PHP_TZ=Australia/Sydney
      - TIMEZONE=Australia/Sydney

I have a number of recurring invoices set up, with the cron task set as:

On the first day of every month at 00:00

the invoices get created, but when I check the content the next morning on 1st October, the invoice date is 30th September (and they were all 31st August last month in September, and before that).

Also, I use a YY-MM date variable in the invoice name, and this month's invoices are all named with 25-09 (for 2025-September) as opposed to 25-10 for October.

I expect them to be using the current month as of the first day of every month at 00:00 - October in this case, so the invoice date should be 1st October and they should all have 25-10 in the name.

My hunch, having suffered timezone issues frequently (living here in ‘the future’ ) is that there is some part of the recurring invoice job that is somehow running on UTC (or maybe another timezone that is behind Australia time) and another part running on Australia time. For example, perhaps the cron job runs based on Australia time and runs at 00:00 1st October as expected, but the part of the code that fetches / creates any date fields within that job, and uses them in 'invoice name' and 'invoice date', and others, is maybe not respecting my timezone, instead using UTC (or some other hard coded default) and fetches like ‘right now today, it’s 1pm on 30th September UTC’ - leading to incorrect outcome.

Steps to Reproduce the issue

This should be reproducible - although waiting for a genuine new month to come around would be slow, so probably need to adjust system time, which may get messy.

Perhaps the same issue can be observed by setting TZ to eg Sydney, and simply generating a recurring invoice every day at 00:00 and looking at the resultant "invoice date" to see if it is happening correctly. My suspicion is that the resultant invoice will be created on Date X, but have an Invoice Date value of "Date X-1"

Expected behaviour

the part of the system that inserts date and months into the invoice should respect my local time zone.

Actual behaviour

it does not, it seems to be a timezone that hasn't yet switched to the next day (or month)

Docker

  • App running in Docker Container.
  • Docker container running behind Reverse proxy.

InvoiceShelf version

2.2.1

PHP version

whatever is shipping in latest image

Database type

sqlite

Database version

latest

Web Browser

not important here, any/all - its app-level

Server OS

Ubuntu - but it's docker

Reverse-proxy logs


Laravel/PHP logs


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions