ChronosChronos

Day Part Plugin

Day Part Plugin — Chronos Plugin Documentation.

About Day Part Plugin

Day Part plugin is a plugin that adds day part related functionalities to Chronos.

Import & Usage

Import

To use the Day Part Plugin, import it first:

import { Chronos, chronos } from "chronos-date";
import { dayPartPlugin } from 'chronos-date/plugins/dayPartPlugin';

Register

Now you can use the plugin's methods:

// Register the plugin globally
Chronos.use(dayPartPlugin);
// or
chronos.use(dayPartPlugin);
// or
Chronos.register(dayPartPlugin);
// or
chronos.register(dayPartPlugin);

Usage

Example usage of the dayPartPlugin:

const c = new Chronos();

const partOfDay = c.getPartOfDay();

console.log(partOfDay);

Example Usage

playground.ts

Overview

The dayPartPlugin adds day part functionalities to Chronos, enabling:

  • Determining the current part of the day

Methods Added by the Plugin

Note

All these methods are provided by dayPartPlugin. You must register it using Chronos.use(dayPartPlugin) before calling them. Once registered, all Chronos instances will have access to these methods.

MethodDescriptionReturns
getPartOfDayDetermines the current part of dayDayPart

API Reference

getPartOfDay()

Signature

getPartOfDay(config?: Partial<DayPartConfig>): DayPart

Parameters

  • config: Custom day part ranges

Return Type

DayPart - Current part of day

Default Ranges

PartRange
midnight00:00-01:00
lateNight02:00-04:00
morning05:00-11:00
afternoon12:00-16:00
evening17:00-20:00
night21:00-23:00

Example

playground.ts

Last updated: Wed, Jun 24, 2026 09:04:13AM (UTC)

On this page