Time/Timezone Utilities

Is Leap Year

Determines whether any given year is a leap year using standard Gregorian calendar rules. Access via MCP in Cursor or Windsurf for instant validation, or call GET /v1/time/is-leap-year with a year parameter. Returns a boolean result — no guesswork about divisibility by 4, 100, or 400. Essential for date calculations and calendar logic in AI agents.

API Endpoint

GET /v1/time/is-leap-year

Code Examples

curl "https://tinyfn.io/v1/time/is-leap-year" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/time/is-leap-year', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/time/is-leap-year',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's time/timezone tools:

{
  "mcpServers": {
    "tinyfn-time": {
      "url": "https://tinyfn.io/mcp/time",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

What years are considered leap years?

Years divisible by 4 are leap years, except years divisible by 100 (not leap), except years divisible by 400 (leap again). So 2000 was a leap year, 1900 wasn't, 2024 is.

How do I check if 2028 is a leap year using MCP?

Call the is-leap-year tool in Cursor or another MCP client with year=2028. Returns true since 2028 is divisible by 4 and not a century year.

What format does the REST API return?

Returns JSON with a boolean result, like {"is_leap_year": true}. Clean, deterministic output for programmatic use.

Can I check historical years like 1800 or future years like 3000?

Yes, the tool handles any valid integer year. 1800 returns false (divisible by 100 but not 400), 3000 returns false for the same reason.

Why use this instead of calculating leap years myself?

Eliminates off-by-one errors and edge case bugs. The century/400-year rules are tricky to implement correctly, especially in AI agent workflows.

Try Is Leap Year Now

Get your free API key and start using Is Leap Year in seconds.

Get Free API Key