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.
| Method | Description | Returns |
|---|---|---|
getPartOfDay | Determines the current part of day | DayPart |
API Reference
getPartOfDay()
Signature
getPartOfDay(config?: Partial<DayPartConfig>): DayPartParameters
config: Custom day part ranges
Return Type
DayPart - Current part of day
Default Ranges
| Part | Range |
|---|---|
midnight | 00:00-01:00 |
lateNight | 02:00-04:00 |
morning | 05:00-11:00 |
afternoon | 12:00-16:00 |
evening | 17:00-20:00 |
night | 21:00-23:00 |
Example
playground.ts
Last updated: Wed, Jun 24, 2026 09:04:13AM (UTC)
