WhatWeek

Week Number for Developers

Build week-number features with API examples, tested JavaScript notes, spreadsheet formulas, and ISO edge cases that catch New Year bugs.

API quick start

GET /api/week
  ?date=2026-05-03
  &system=iso
  &timezone=Asia/Singapore
{
  "date": "2026-05-03",
  "timezone": "Asia/Singapore",
  "system": "iso",
  "weekYear": 2026,
  "weekNumber": 18,
  "iso": "2026-W18-7",
  "weekStarts": "2026-04-27",
  "weekEnds": "2026-05-03",
  "weeksInYear": 53
}

API documentation

Validate dates, timezones, week systems, and 53-week years with small JSON responses.

Open API docs

JavaScript ISO weeks

Use tested helpers and avoid local-time parsing bugs around late December and early January.

Read JavaScript guide

Excel and Sheets

Pick the right formula for ISO weeks, US-style weeks, and spreadsheet planning workflows.

Read formula guide

JavaScript example

Use explicit calendar dates and read the week-year separately from the calendar year. The full guide explains timezone and parsing pitfalls.

For the rule itself, read the ISO week date guide.

  • Avoid parsing bare date strings through local time.
  • Keep week-year separate from calendar year.
  • Test Dec 29-Jan 4 before shipping date logic.

Fetch example

const url = new URL(
  'https://whatweek.is/api/week'
);
url.search = new URLSearchParams({
  date: '2026-05-03',
  system: 'iso',
  timezone: 'Asia/Singapore',
});

const response = await fetch(url);
const week = await response.json();

console.log(week.iso); // 2026-W18-7

Excel and Google Sheets

Use ISOWEEKNUM for ISO week numbers. Use WEEKNUM carefully because its default system can differ. The spreadsheet guide covers Excel, Google Sheets, and the common ISO vs Sunday-start mismatch.

=ISOWEEKNUM(DATE(2026,5,3))
=WEEKNUM(DATE(2026,5,3),21)

Open Excel week number guide

Edge cases to test

Always test dates around December 29 through January 4. ISO week-years can differ from calendar years around New Year.

2025-12-29
2026-W01
Calendar year and ISO week-year differ.
2026-05-03
2026-W18
A Sunday ends the ISO week.
2026-12-28
2026-W53
2026 includes an ISO Week 53.

Implementation checklist

  • Parse dates as explicit calendar dates, not vague local-time strings.
  • Return the week-year separately from the calendar year.
  • Validate week 53 only for ISO years that actually have 53 weeks.
  • Show the timezone used for current-week calculations.