1.0.9 • Published 12 months ago

@chce/weeknumber-iso8601 v1.0.9

Weekly downloads
-
License
MIT-0
Repository
github
Last release
12 months ago

weeknumber-iso8601

A lightweight(186 bytes minified) function to calculate the ISO 8601 week number for a given Date-object. Includes TS-definition.

Installation

Install via npm:

npm install weeknumber-iso8601

Usage

import { getWeekNumberISO8601 } from 'weeknumber-iso8601';

const date = new Date('2024-11-13');
const weekNumber = getWeekNumberISO8601(date);
console.log(`Week number: ${weekNumber}`);

Example

const date1 = new Date('2024-01-03'); // Early January
console.log(`Week number: ${getWeekNumberISO8601(date1)}`); // Should return 1

const date2 = new Date('2024-12-31'); // End of the year
console.log(`Week number: ${getWeekNumberISO8601(date2)}`); // Should return the last week number of 2024

License

This library is open source and licensed under the MIT-0 License. (No attribution needed in your minified bundle)

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months 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