Hyperlinkv0.8.0-beta.28

DateTime

DateTime.nowUnsafeconsteffect/DateTime.ts:884
(): Utc

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))
constructors
export const nowUnsafe: LazyArg<Utc> = Internal.nowUnsafe