improved

Booking Status Change - Datetime tracking and Status history preservation

We've improved booking's status change tracking to provide more accurate timestamps and preserve historical status change data throughout the booking lifecycle.

What's New?


1. Precise DateTime Tracking with status_at

We now support precise date-time tracking when changing booking statuses with the new status_at parameter.

New Datetime Fields:

  • tentative_at - exact timestamp when booking became tentative
  • definite_at - exact timestamp when booking became definite
  • lost_at - exact timestamp when booking became lost
    # Set precise datetime for status change
    POST v2/bookings/123/change_status
    {
      "status": "definite",
      "status_at": "2025-01-15T14:30:00Z"
    }
    
    # Response includes both date and datetime fields
    {
      "status": "definite",
      "definite_date": "2025-01-15",
      "definite_at": "2025-01-15T14:30:00Z"
    }

2. Status History Preservation

Status dates are now preserved when transitioning between statuses, providing complete track of previous status changes.

Previous Behaviour

# Changing tentative → definite would lose tentative_date
{
  "status": "definite",
  "definite_date": "2025-01-15",
  "tentative_date": null,  # ❌ Lost historical data
}

New Behaviour (History Preserve)

# Changing tentative → definite preserves tentative history
{
  "status": "definite",
  "definite_date": "2025-01-15",
  "definite_at": "2025-01-15T14:30:00Z",
  "tentative_date": "2025-01-10",        # ✅ Preserved
  "tentative_at": "2025-01-10T09:15:00Z" # ✅ Preserved
}

Exception: When changing TO lead, tentative and definite status, the lost_date and lost_at are cleared as they become irrelevant.


3. Backward Compatibility with status_date

The existing status_date parameter continues to work as before, maintaining full backward compatibility.

# Using status_date (existing behavior)
POST v2/bookings/123/change_status
{
  "status": "tentative",
  "status_date": "2025-01-10"
}

# Response includes both date and datetime fields
{
  "status": "tentative",
  "tentative_date": "2025-01-10",
  "tentative_at": "2025-01-10T00:00:00Z"  # Start of the day
}

API parameters

ParamTypeDescription
status_atdate-timeNEW - Set precise timestamp for status change
status_datedateEXISTING - Set date for status change (backward compatible)

Response fields

All booking responses now include enhanced status tracking fields:

{
  "id": 123,
  "status": "definite",
  
  # Date fields (existing)
  "tentative_date": "2025-01-10",
  "definite_date": "2025-01-15", 
  "lost_date": null,
  
  # DateTime fields (new)
  "tentative_at": "2025-01-10T09:15:00Z",
  "definite_at": "2025-01-15T14:30:00Z",
  "lost_at": null
}

Affected Endpoints

POST v2/bookings/{id}/change_status
GET /v2/bookings/{id} (response includes new datetime fields)