calendarize is a minimalist (202B) JavaScript utility designed to generate structured calendar views for a given month. Currently at version 1.1.1, it provides an array of arrays representing weeks, where each inner array contains 7 numbers corresponding to days of the month, with `0` indicating days outside the current month. The library is highly flexible, providing no date labels or internationalization (i18n) directly, which allows developers complete control over localization and rendering. It ships as ES Module, CommonJS, and UMD, making it suitable for various environments. Its main differentiator is its tiny footprint and unopinionated output, focusing solely on the grid structure rather than presentation, and it has a steady, albeit slow, release cadence driven by community contributions for minor enhancements.
npm install calendarizeVerified import paths — ran on the pinned version, not inferred.
Demonstrates generating a calendar view for a given date, including how to specify a different start day for the week using the `offset` parameter.
Always pass a `Date` object initialized with the desired timezone, e.g., `new Date('YYYY-MM-DDTHH:MM:SSZ')` or use robust date parsing libraries (like `date-fns` or `luxon`) to create a `Date` object before passing it to `calendarize`.When iterating through the `Week` arrays, add a conditional check for `day === 0` to render an empty cell or specific placeholder (e.g., `''` or `null`) instead of attempting to process `0` as a valid date number.
Integrate with an i18n library or manually create arrays for day labels (`['Sun', 'Mon', ...]`) and month names, mapping them to the `calendarize` output based on the `offset` parameter and locale expectations.
Ensure your project's `calendarize` dependency is at version `1.1.0` or higher to utilize the `offset` parameter. Update your `package.json` to specify `"calendarize": ">=1.1.0"` or run `npm install calendarize@latest`.
To prevent timezone-related errors, always provide a `Date` object with explicit timezone control (e.g., `new Date('YYYY-MM-DDT00:00:00Z')`). For the week start, verify the `offset` value: `0` for Sunday (default), `1` for Monday, etc., to match your desired calendar layout. Ensure `calendarize` is `v1.1.0` or higher to use `offset`.When iterating through the `Week` arrays, add a conditional check: `if (day === 0) { /* render empty */ } else { /* render day */ }`. This prevents processing `0` as a real date and allows for correct visual representation of empty cells.No dependency data recorded yet.