Skip to main content
This release is 2 versions behind 0.9.3 — the latest version of @dnl-fm/zeit-ts. Jump to latest

Built and signed on GitHub Actions

Helps syncing/reading user dates in your database

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a week ago (0.9.1)
class DatabaseZeit

Represents a Zeit (time) object in the database timezone (UTC).

Constructors

new
DatabaseZeit(
dateTime: DateTime,
userTimezone: Timezone,
)

Creates a new DatabaseZeit instance.

Methods

get(unit: keyof DateTime): number

Gets the value of the specified unit from the DateTime object.

Gets the timezone of this DatabaseZeit (always UTC).

getZeit(): DateTime

Gets the Luxon DateTime object for this DatabaseZeit.

minus(duration: DurationLike): DatabaseZeit

Subtracts a duration from the current time.

plus(duration: DurationLike): DatabaseZeit

Adds a duration to the current time.

set(values: DateObjectUnits): DatabaseZeit

Sets specified components of the date/time.

Converts the DatabaseZeit to an ISO 8601 string.

Converts the DatabaseZeit to an ISO 8601 date string (without time).

Converts this DatabaseZeit to a UserZeit in the user's timezone.

Converts this DatabaseZeit to a UserZeit ISO 8601 string in the user's timezone.

Converts this DatabaseZeit to a UserZeit ISO 8601 date string (without time) in the user's timezone.

Add Package

deno add jsr:@dnl-fm/zeit-ts

Import symbol

import { DatabaseZeit } from "@dnl-fm/zeit-ts";

---- OR ----

Import directly with a jsr specifier

import { DatabaseZeit } from "jsr:@dnl-fm/zeit-ts";

Add Package

npx jsr add @dnl-fm/zeit-ts

Import symbol

import { DatabaseZeit } from "@dnl-fm/zeit-ts";

Add Package

yarn dlx jsr add @dnl-fm/zeit-ts

Import symbol

import { DatabaseZeit } from "@dnl-fm/zeit-ts";

Add Package

pnpm dlx jsr add @dnl-fm/zeit-ts

Import symbol

import { DatabaseZeit } from "@dnl-fm/zeit-ts";

Add Package

bunx jsr add @dnl-fm/zeit-ts

Import symbol

import { DatabaseZeit } from "@dnl-fm/zeit-ts";