# getZonedNowUnit

Industry: Core

## Signature

```ts
getZonedNowUnit(ianaTimezone: string, unit: ZonedNowUnit): string
```

Return the requested current unit value for the specified IANA timeZone.

- Uses Temporal.Now.zonedDateTimeISO() to get the current time.
- `week` is the ISO 8601 week number, from `parseWeekFromDate`.
- Validation is performed on timezone and unit.
- `unit` accepts the singular or plural name of a Temporal unit (`"hour"` or `"hours"`), as Temporal does; `"dayOfWeek"` has no plural.
- The `"year"` unit is written as Temporal writes a year: four digits (`"2024"`, `"0005"`), or a sign and six digits outside 0000–9999 (`"+010000"`, `"-000005"`).

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `ianaTimezone` | `string` | IANA name or UTC offset: a time zone identifier (`+05:30`, `+0530`, `-08`) or a stored offset (`±HH:MM[:SS]`, what `getTimeZoneOffset` returns) |
| `unit` | `ZonedNowUnit` | unit to extract from current zoned time |

## Returns

string representation of the requested unit or "" on invalid input

## Types

### ZonedNowUnit

Units extractable from the current time in a specific IANA timeZone, as consumed by `getZonedNowUnit`.

```ts
import type { ZonedNowUnit } from "@northguild/gmt";
```

```ts
"dayOfWeek" | SmallestUnit<"year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond">
```

## Examples

```ts
import { getZonedNowUnit } from "@northguild/gmt/zoned/get";

getZonedNowUnit("Asia/Tokyo", "hour") // "23"
```

## Source

[zoned/get/getZonedNowUnit.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/zoned/get/getZonedNowUnit.ts)
