0.0.4 • Published 7 months ago

js-daterange v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Date Range Utils

A utility package for handling date ranges across different timezones.

Installation

npm install @yourusername/date-range-utils

Usage

import { Period, DateFormat, DateRange } from '@yourusername/date-range-utils';

// Create a Period instance with a specific timezone and date format
const period = new Period('America/New_York', DateFormat.YYYY_MM_DD);

// Get date range for last month
const lastMonthRange = period.createDefinedRange(DateRange.LAST_MONTH);

// Create a custom date range (e.g., last 7 days including today)
const customRange = period.createCustomRange(7, true);

Methods

  • createDefinedRange(dateRange: DateRange): Get predefined date ranges
  • createCustomRange(prevDays: number, includingToday: boolean): Create custom date ranges
  • getOffset(timeZone: string): Get timezone offset

License

MIT

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago