post https://example.com/organizations//locations//roles//shifts/
Permission Required: Location Manager
Managers are limited to their location. Organization administrators have access in all locations.
Be Careful About Timezones
Start and stop times are stored in Staffjoy databases in UTC time. When creating a shift, it is best to be specific.
In the example on the side, the
start
gives a time of08:00:00-08:00
, which would be 8 AM with a local timezone offset of 8 hours. The response shows that in UTC this same time is00:00:00+00:00
. If thestart
param only sent08:00:00
, this would be interpreted as UTC, and then the shift would actually start at16:00:00
in the local timezone!To avoid problems, follow these tips:
- Use a library for timezone conversions such as pytz. The adjustment needed to convert between a local time and UTC changes depending on Daylight Savings Time.
- Never use naive datetimes. It's best to convert everything to UTC before sending to Staffjoy, but it is ok to send the timezone offset too.