Error: Scheduled Date Must Be in the Future

Whenever I try to publish an invoice, I get the message “Scheduled Date Must Be in the Future”. It does this for any date that is entered in the future or present. Suggestions?

Can you provide your application id and I’ll take a look at the logs to see how we’re dissecting it? Also feel free to share a short code snippet here so I can take a look at that (without access token of course).

Hello thank you for your response,
here is application ID sq0idp-2D4f9BX1LjkP7nqSKUGwqg

So for the last invoice (ChDgS5PtQRWDaxsPzeaWYMMAEK0B), the scheduled_at was 2021-03-05T00:00:00Z, which was about 19 and a half hours ago, so it’s definitely not in the future. Can you share an invoice_id where you put scheduled_at in the future?

I created an invoice for March 8th and it worked, however, when I try to create an invoice for todays date, it never lets me publish it.

Can you share an example of a time you’ve tested? The one from above was in the past (you set it for midnight UTC). Note that it’s UTC time if you’re not specifying a timezone.

Hello,
Sorry for the late reply my developer and I have been investigating further. Please take a look at this screenshot that I have provided. I created this invoice at 14:35 and scheduled it for 14:40. However, please note the discrepancy for the “created_at” and “updated_at” times. Why is the created at date 5 hours into the future for the actual created at time?

Those are all UTC times. If you intended to do it in your timezone, you need to specify as such. For example PST offset would be: 2021-03-08T14:40:00-08:00 (notice the “-08:00”) for 14:40. Since you didn’t pass a timezone, it marked it as a 14:40 UTC time. This should fail when you pass it to PublishInvoice since it’s still not in the future.

The 14:40 scheduled time was correct for my timezone as noted by the America/New_York. But the real created_at time was 14:35 (est) not 19:35.

The created_at time and updated_at time do not have any inputs from my end. The only input I have is scheduled date and due date, so why is the created date different?

We believe this is the issue that is not allowing us to publish invoice correctly.

That’s not correct. Those times you can see end with “Z”, which always means UTC. As I mentioned, if you want to use your timezone, you need to specify it with the ending “-05:00” (since you’re EST, I think?). The “timezone” field is just there so you can interpret it for the location, but timestamps are always returned in UTC time.

I will have my developer take a look and get back to you in a few hours, thank you for your help in the meantime.

1 Like

Hello,
We are still having issues with setting the correct time according to UTC. The scheduled_at time is appearing correctly however the created_at and updated_at are still 5 hours ahead. I understand that Eastern Standard Time (EST) is 5 hours behind UTC, but we can’t seem to find where to specify the “-05:00”.

Additionally, according to the API for scheduled_at: “If the field is not set, Square processes the invoice immediately after it is published.” However, we have tried not setting this field and receive an “invalid date” message".

All dates that are returned via the API are always going to be in UTC; there’s no way to change that. The “-05:00” I was mentioned is solely for the scheduled_at because that’s the only one you can set…however, even when you set it, when you retrieve it, it’s still going to be in UTC time. If you want to view them in your own timezone, you’d need to do some work on your own application to convert the times.

For example, in the above screenshot, your created_at is actually 19:35-5 == “14:35 EST”. But your scheduled_at is actually at 14:40-5 == “9:40 EST”. If you’re trying to set scheduled_at to 14:40 EST, then you would need to pass “2021-03-08T14:40:00-05:00”. This uses “14:40 EST” but when you actually view the scheduled_at, it will still be in UTC time, so you’ll see “2021-03-08T19:40:00Z”.

I’ll take a look at your second inquiry and ping the team. I’ll follow up once I have more info on that, thanks for reporting.

1 Like

Thanks,
We have decided that it may be best to bypass the scheduled_at time completely as different users in different timezones would have conflicting times for publishing.

If we could get more information for the “If the field is not set, Square processes the invoice immediately after it is published” that would be great.

The 14:40 booked time was right for my timezone as verified by the America/New_York. Be that as it may, the genuine created_at time was 14:35 (est) not 19:35.

The created_at time and updated_at time don’t have any contributions from my end. The solitary information I have is booked date and due date, so for what reason is the made date unique?

We accept this is the issue that isn’t permitting us to distribute receipt effectively.

As I mentioned earlier, the 19:35 is UTC time, which is equivalent to 14:35 EST, so it is correct. I’m not sure what you mean by “for what reason is the made date unique”; can you clarify? Just to reiterate: all dates from the API are in UTC timezone, not your local timezone.