1.0.13 • Published 1 year ago

chronokit v1.0.13

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

ChronoKit

ChronoKit is a powerful and flexible date/time manipulation library for Node.js. With an intuitive API, ChronoKit makes it easy to perform common tasks such as converting between time zones, calculating time differences, and parsing date/time strings. Whether you're building a web app, working with time-based data, or just need to handle dates and times in your code, ChronoKit has you covered.

Date/Time Manipulation Library

A library that provides utility function with dates and time, including coverting between time zone, calculating time diference, and parsing date/time strings. This library is build for Node.js and can be used in any Node.js project.

Installation

To install the library, use the following command:

  • npm i chronokit

Usage

To use the library in your project, simply require it and start using the function:

import {convertTimeZone, convertDateTime, getTimeZoneOffSet} from 'chronokit';

const convertedTimeZone = convertTimeZone('2023-02-23T14:55:00Z', 'GMT', 'Australia/Darwin');
const convertedDateTime = convertDateTime('2023-02-23T23:35:00', 'Asia/Colombo', 'Europe/London');
const timeZoneOffSet = getTimeZoneOffSet('Asia/Colombo', 'Europe/London'); 
const month = performDateArithmetic(currentDate, { duration: 5, unit: 'month', operation: 'subtract' });

API Reference

convertTimeZone(dateTime, fromZone, toZone)

convertDateTime(dateTime, fromTimeZone, toTimeZone)

getTimeZoneOffset(timezone1, timezone2)

performDateArithmetic(currentDate, { duration: number, unit: string, operation: string })

performDateArithmetic(currentDate, { duration: 2, unit: 'week', operation: 'add' });
console.log(`Current date: ${currentDate.format('YYYY-MM-DD')}`);
console.log(`Two weeks later: ${twoWeeksLater.format('YYYY-MM-DD')}`);

output: Current date: 2023-02-25 Two weeks later: 2023-03-11

Contributing

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago