Navigation
POST datetime

working_hours_clamp

1 credit

Clamp a datetime to the nearest working hour (Mon-Fri, configurable start/end)

Endpoint

POST /api/v1/tools/datetime/working_hours_clamp

Body Parameters

timezone string optional default: "UTC"
work_end string optional default: "17:00"
work_start string optional default: "09:00"
datetime_str string required

Example

input Request
{
    "work_end": "17:00",
    "work_start": "09:00",
    "datetime_str": "2024-03-16T22:00:00"
}
output Response
{
    "clamped": "2024-03-18T09:00:00",
    "original": "2024-03-16T22:00:00",
    "was_clamped": true
}

Response Format

HTTP/1.1 200 OK SUCCESS
{
  "success": true,
  "data": {
    "clamped": "2024-03-18T09:00:00",
    "original": "2024-03-16T22:00:00",
    "was_clamped": true
},
  "meta": {
    "tool": "working_hours_clamp",
    "credits_consumed": 1
  }
}
HTTP/1.1 422 Unprocessable Entity ERROR
{
  "success": false,
  "data": null,
  "error": {
    "code": "validation_error",
    "message": "The given data was invalid."
  }
}

Sign in to try this tool directly from the docs.

Code Examples
Request Example
lightbulb Developer Tip

Credits are deducted before execution. If the upstream tool fails, credits are automatically refunded to your account.