Skip to main content
This release is 4 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.8.0)
class Cycles

Represents a collection of time periods (cycles).

Constructors

new
Cycles(periods: ZeitPeriod[])

Creates a new Cycles instance.

Methods

Finds the nearest period after the given date.

Finds the nearest period before the given date.

Finds the period that contains the given date.

private
getCurrentDateTime(): DateTime

Gets the current date and time in the timezone of the first period.

Retrieves the first period in this Cycles instance.

Retrieves the last period in this Cycles instance.

Gets the total number of periods in this Cycles instance.

Retrieves all periods in this Cycles instance.

Converts a ZeitSchema to a UserZeit object.

Static Methods

Creates a new Cycles instance from an array of periods.

Add Package

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

Import symbol

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

---- OR ----

Import directly with a jsr specifier

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

Add Package

npx jsr add @dnl-fm/zeit-ts

Import symbol

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

Add Package

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

Import symbol

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

Add Package

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

Import symbol

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

Add Package

bunx jsr add @dnl-fm/zeit-ts

Import symbol

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