Chronos Wrapper Function
Overview​
Function wrapper around the Chronos class that provides identical functionality with a simpler interface. All Chronos features are available through this function.
Key Features​
- Same functionality as 
new Chronos()but with function syntax - Full access to all 
Chronosinstance methods - Inherits all static methods from 
Chronosclass (chronoswithout call signature) - Supports all 
Chronosinput types - Maintains identical type safety
 
🧩 Plugin System​
Chronos supports a modular plugin system that allows you to extend its capabilities without bloating the core. Plugin methods are not available by default—you must explicitly install them using the .use() static method.
How it works​
import { Chronos } from 'nhb-toolbox';
import { seasonPlugin } from 'nhb-toolbox/plugins/seasonPlugin';
chronos.use(seasonPlugin); // Register the plugin before using its methods
console.log(chronos().season()); // ✅ Safe to use after plugin registration
Each plugin enhances the Chronos prototype and becomes available globally after registration.
Usage​
Import​
import { chronos } from 'nhb-toolbox';
Basic Instantiation​
// Function style
const date = chronos('2023-12-31')
date.year // 2023
date.formatStrict() // Formatted date string
// Class style (equivalent)
const date = new Chronos('2023-12-31')
date.year // 2023
date.formatStrict() // Formatted date string
With Components​
const date = chronos(2023, 12, 31, 15, 30)
date.year // 2023
date.formatStrict() // Formatted date string
Available Methods​
The wrapper provides access to all Chronos methods through the returned instance:
- Public Properties - Access public properties for debugging
 - Getters - Access date components
 - Format Methods - Date display formatting
 - Name Getter Methods - Get names of the date parts (day-name, month-name etc.)
 - Calculation Methods - Date math operations
 - Checker Methods - Date validation
 - Conversion Methods - Type transformations
 - Component Methods - Date part manipulation
 - Comparison Methods - Date relation checks
 - Chronos Plugins - Learn about 
Chronosplugins - String Methods - Get time as string (some are just augmentation of JS defaults)
 - Extra Time Information - Get extra information about part of year, month, day/date etc.
 
Static Methods​
All Chronos static methods are available directly on the wrapper function:
import { Chronos } from 'nhb-toolbox';
import { timeZonePlugin } from 'nhb-toolbox/plugins/timeZonePlugin';
// Using wrapper function
chronos.parse('2023-12-31', 'YYYY-MM-DD')
chronos.use(timeZonePlugin)
chronos.today()
chronos.isLeapYear(2024)
// Using class (equivalent)
Chronos.parse('2023-12-31', 'YYYY-MM-DD')
Chronos.today()
Chronos.isLeapYear(2024)
Aliases​
The chronos function is also available under the following aliases:
chronosjschronostschronuschronusjschronusts
These aliases exist to support flexible naming conventions and common user preferences.
Full Documentation​
For complete method documentation, see the Chronos class reference. All methods shown there are available through this wrapper.