effect-io-ai

Package: effect
Module: DateTime

DateTime.nowUnsafe

Gets the current time using Date.now.

When to use

Use when synchronous wall-clock access outside an Effect program is acceptable and testability through the Clock service is not needed.

Details

This is a synchronous version of now that directly uses Date.now() instead of the Effect Clock service.

Example (Getting the current DateTime unsafely)

import { DateTime } from "effect"

const now = DateTime.nowUnsafe()
console.log(DateTime.formatIso(now))

Signature

declare const nowUnsafe: LazyArg<Utc>

Source

Since v4.0.0