Skip to content

Timezone Handling

The Partner API provides flexible timezone handling through the optional X-Client-Timezone HTTP header. This allows partners to receive dates and times in their users' local timezone without client-side conversion.

Overview

By default, all dates and times in API responses are returned in UTC using ISO 8601 format. Partners can optionally request localized times by including the X-Client-Timezone header with a valid IANA timezone identifier.

Request Header

Header Required Format Example
X-Client-Timezone No IANA identifier or abbreviation America/New_York, EST, PST

The header accepts two formats:

  1. IANA timezone identifiers (e.g., America/New_York) - DST-aware; automatically adjusts between standard and daylight time based on the date
  2. Timezone abbreviations (e.g., EST, PDT) - Fixed offset; always uses the same UTC offset regardless of date

This distinction allows you to choose whether you want automatic DST handling or explicit control over the offset.

Response Behavior

Request Header Response Behavior Response Header
Missing Times in UTC Not included
Valid IANA timezone Times in specified timezone Echoes the timezone used
Invalid value Times in UTC (fallback) UTC

Timestamp Format

All timestamps are returned in ISO 8601 format:

  • UTC (default): Uses the Z suffix notation (e.g., 2024-01-15T19:30:00Z)
  • With timezone: Includes the UTC offset (e.g., 2024-01-15T14:30:00-05:00)

Examples

Example 1: No Header (Default UTC)

Request:

GET /api/partner/v1/meetings/mtg_abc123
Authorization: Bearer <token>

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": "mtg_abc123",
  "title": "Project Sync",
  "scheduled_start": "2024-01-15T19:30:00Z",
  "scheduled_end": "2024-01-15T20:30:00Z",
  "created_at": "2024-01-10T14:22:00Z"
}

No X-Client-Timezone response header is included.


Example 2: Valid Timezone

Request:

GET /api/partner/v1/meetings/mtg_abc123
Authorization: Bearer <token>
X-Client-Timezone: America/New_York

Response:

HTTP/1.1 200 OK
Content-Type: application/json
X-Client-Timezone: America/New_York

{
  "id": "mtg_abc123",
  "title": "Project Sync",
  "scheduled_start": "2024-01-15T14:30:00-05:00",
  "scheduled_end": "2024-01-15T15:30:00-05:00",
  "created_at": "2024-01-10T09:22:00-05:00"
}

The response header echoes America/New_York, confirming the timezone used.


Example 3: Invalid Timezone (Fallback to UTC)

Request:

GET /api/partner/v1/meetings/mtg_abc123
Authorization: Bearer <token>
X-Client-Timezone: Invalid/Timezone

Response:

HTTP/1.1 200 OK
Content-Type: application/json
X-Client-Timezone: UTC

{
  "id": "mtg_abc123",
  "title": "Project Sync",
  "scheduled_start": "2024-01-15T19:30:00Z",
  "scheduled_end": "2024-01-15T20:30:00Z",
  "created_at": "2024-01-10T14:22:00Z"
}

The response header returns UTC, indicating the fallback was applied. No error is returned—the API silently defaults to UTC.


Request Body Timestamps

When sending timestamps in request bodies (e.g., creating or updating meetings), you should:

  1. Preferred: Send timestamps in UTC with Z suffix
  2. Acceptable: Include an explicit offset (e.g., -05:00)
{
  "title": "Team Standup",
  "scheduled_start": "2024-01-20T15:00:00Z",
  "scheduled_end": "2024-01-20T15:30:00Z"
}

The X-Client-Timezone header does not affect how request body timestamps are interpreted—they are always parsed as provided.

Date-Only Fields

Fields containing only a date (no time component) are not affected by the timezone header. These are returned as-is in YYYY-MM-DD format.

IANA Identifiers vs Abbreviations

Understanding the difference between these two formats is important for handling Daylight Saving Time correctly.

IANA Timezone Identifiers (DST-Aware)

IANA identifiers automatically switch between standard and daylight time based on the date:

Region IANA Identifier Winter (Standard) Summer (Daylight)
US Eastern America/New_York UTC-05:00 (EST) UTC-04:00 (EDT)
US Central America/Chicago UTC-06:00 (CST) UTC-05:00 (CDT)
US Mountain America/Denver UTC-07:00 (MST) UTC-06:00 (MDT)
US Pacific America/Los_Angeles UTC-08:00 (PST) UTC-07:00 (PDT)
UK Europe/London UTC+00:00 (GMT) UTC+01:00 (BST)
Central Europe Europe/Paris UTC+01:00 (CET) UTC+02:00 (CEST)
Japan Asia/Tokyo UTC+09:00 (JST) (no DST)
Australia Eastern Australia/Sydney UTC+10:00 (AEST) UTC+11:00 (AEDT)

For a complete list, see the IANA Time Zone Database.

Timezone Abbreviations (Fixed Offset)

Abbreviations always use a fixed UTC offset, regardless of the current date. Use these when you need explicit control and don't want automatic DST adjustment:

Abbreviation Fixed Offset Notes
EST UTC-05:00 Eastern Standard Time
EDT UTC-04:00 Eastern Daylight Time
CST UTC-06:00 Central Standard Time (US)
CDT UTC-05:00 Central Daylight Time
MST UTC-07:00 Mountain Standard Time
MDT UTC-06:00 Mountain Daylight Time
PST UTC-08:00 Pacific Standard Time
PDT UTC-07:00 Pacific Daylight Time
GMT UTC+00:00 Greenwich Mean Time
UTC UTC+00:00 Coordinated Universal Time
BST UTC+01:00 British Summer Time
CET UTC+01:00 Central European Time
CEST UTC+02:00 Central European Summer Time
JST UTC+09:00 Japan Standard Time
AEST UTC+10:00 Australian Eastern Standard Time
AEDT UTC+11:00 Australian Eastern Daylight Time

Ambiguous Abbreviations

Some abbreviations like CST can refer to multiple timezones (US Central, China, Cuba). The API uses US-centric interpretation for ambiguous abbreviations.

Choosing Between Formats

Use Case Recommended Format Example
Display times in user's local timezone IANA identifier America/New_York
Always show Eastern Standard Time (no DST) Abbreviation EST
Consistent offset for reporting/analytics Abbreviation PST
Match user's device/browser timezone IANA identifier Europe/London

Best Practices

  1. Store UTC, display local: Store all timestamps in UTC server-side. Use this header for display purposes only.

  2. Use IANA identifiers for user-facing times: They automatically handle DST transitions correctly.

  3. Use abbreviations for fixed-offset requirements: When you need a consistent offset regardless of date (e.g., "always show PST for West Coast reports").

  4. Validate timezone client-side: Check that the timezone value is valid before sending to avoid unexpected UTC fallback.

  5. Cache considerations: If caching API responses, include X-Client-Timezone in your cache key, as the same endpoint returns different values based on this header.

SDK Support

The Partner SDK provides helper methods for timezone handling:

import { ContioPartnerClient } from '@contio/partner-sdk';

const client = new ContioPartnerClient({
  // ... other config
  defaultTimezone: 'America/New_York'  // Applied to all requests
});

// Or per-request:
const meeting = await client.meetings.get('mtg_abc123', {
  timezone: 'Europe/London'
});