# getWeekOfMonth

Industry: Core

## Signature

```ts
getWeekOfMonth(value: string, locale: string | string[]): number | null
```

Return the 1-based row `value` falls on within its month's calendar grid, using `locale`'s first day of week.

- Week 1 is the row containing the 1st of the month: UTS #35's week of month (`W`, Part 4 Dates § Week Data) with the locale's first day of week and minimal days fixed at 1. The locale's own minDays (4 in much of Europe) is not applied, so a short leading week still counts: a month grid draws every day of the month.
- Distinct from ISO `weekOfYear`: this counts rows within a single month's grid, reset every month, rather than weeks since Jan 1.
- Resolves the locale's first day of week via `Intl.Locale.prototype.weekInfo`.
- Returns null if `value` or `locale` is invalid.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | ISO PlainDate string |
| `locale` | `string` \| `string[]` | BCP 47 locale tag (e.g. "fr-FR", "ja-JP", "en-US"), or a preference list of tags (ECMA-402; the first with locale data is read). Required: omitted, or an empty list (which ECMA-402 would resolve to the host default), returns null |

## Returns

1-based week-of-month row, or null on invalid input

## Examples

```ts
import { getWeekOfMonth } from "@northguild/gmt/plain/calculate";

getWeekOfMonth("2024-02-01", "ja-JP") // 1
```

## Source

[plain/calculate/getWeekOfMonth.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/plain/calculate/getWeekOfMonth.ts)
