Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Getting Started >

Start Date of employee is not displaying correctly based of timezone settings

Started by Anas Pav -   in Getting Started


First of all I'd like to thank you for doing a great job with the Xero libraries for integrating with your system :).

Currently my company I work for has an integration with Xero's system where one of the functionalities we provide is creating new employees in the platform through the payroll AU API. Recently we have received various requests form our customers (the majority of them located in Australia) stating that the starting date of their employees is not coinciding with their actual start date.

In our actual implementation we are sending the StartDate in the ISO8601 format YYYY-MM-DDThh:mm:ssTZD in UTC but it doesn't seem any transformations on the date are made based on the user's timezone settings on the Xero platform. We have also created a testing account and sent the date using the unix timestamp in the format eg: StartDate: /Date(1623679200000+0000)/ following the API docs example here. We did that in case the API just read the YYYY-MM-DD portion of the previous format we sent in our actual integration. But even with the timestamp we realised that the start date is presented as UTC in the platform even through our timezone settings are set to our current timezone (UTC+10). So if the StartDate of an employee is set as 2021-06-14T14:00:00+00:00 in UTC it should shown as 2021-06-15 in your platform and not as 2021-06-14 if the timezone is set to UTC+10.

I'm not sure if it's an issue on the platform but could someone advice us on how exactly the StartDate date field handling is happening? Does the timezone setting in the platform affect the way the dates are presented in it? And lastly whether we need to make any changes on the format we send the date through the Payroll API for having the employee StartDate presented with the correct value?

As I wasn't sure where to make this post, feel free to move it in the correct category as you see fit. :)

Thank you for your time!
Official Xero Reply

Generally speaking for date fields we ignore any time element included. As such in your example we would have:
1 - converted the timestamp 1623679200000 into a date and time 14 June 2021 14:00:00
2 - removed the time element - leaving just Monday, 14 June 2021

The timezone of your organisation is largely ignored for the purposes of storing dates.

To use the 15th as the startdate, you would need to pass that with no time or timezone specified eg. 15 June 2021 00:00 or 1623715200000.



Robin B (Community Manager)