Timezone Groups
timezone-groups
is a versatile NPM package that allows you to effortlessly generate timezone groups in both Node.js and browser environments. It supports multiple date libraries, including the option to create and use custom ones.
Features
- Compatible with Node.js and the latest two browser versions.
- Supports various date libraries for generating groups, including the ability to use custom ones.
Installation
Install the package via NPM using the following command:
npm install timezone-groups
Usage
groupByOffset
import { groupByOffset } from "timezone-groups/groupByOffset";
import { DateEngine } from "timezone-groups/groupByOffset/strategy/native";
const timeZoneGroups = await groupByOffset({
startDate,
groupDateRange,
dateEngine: new DateEngine(),
});
console.log(timeZoneGroups);
groupByName
import { groupByName } from "timezone-groups/groupByName";
const timeZoneGroups = await groupByName();
console.log(timeZoneGroups);
groupByRegion
import { groupByRegion } from "timezone-groups/groupByRegion";
const timeZoneGroups = await groupByRegion();
console.log(timeZoneGroups);
Notes