effect-io-ai

Package: effect
Module: DateTime

DateTime.getPartUtc

Get a part of a DateTime as a number.

The part will be in the UTC time zone.

Example

import * as assert from "node:assert"
import { DateTime } from "effect"

const now = DateTime.unsafeMake({ year: 2024 })
const year = DateTime.getPartUtc(now, "year")
assert.strictEqual(year, 2024)

Signature

declare const getPartUtc: { (part: keyof DateTime.PartsWithWeekday): (self: DateTime) => number; (self: DateTime, part: keyof DateTime.PartsWithWeekday): number; }

Source

Since v3.6.0