Skip to content

Commit ace82aa

Browse files
authored
#130 Release 0.0.10 #131
#130 Release 0.0.10
2 parents a565c5b + 376096c commit ace82aa

File tree

14 files changed

+71
-35
lines changed

14 files changed

+71
-35
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# calendar-widgets
22

33
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4-
![Current bundle size: 32.11 kB](https://img.shields.io/badge/Bundle_Size-32.11_kB-green.svg)
4+
![Current bundle size: 171.23 kB](https://img.shields.io/badge/Bundle_Size-171.23_kB-green.svg)
55

66
Working with dates sucks, working with calendars sucks even more. Here's an attempt at making things less sucky. Website: [http://www.calendar-widgets.com/](http://www.calendar-widgets.com/)
77

@@ -35,8 +35,9 @@ pnpm install calendar-widgets
3535
Once the package is installed, you'll have access to an array of helpers and utilities that do a lot of the heavy lifting when it comes to dates and calendars.
3636

3737
### Helpers
38-
- [`getCalendarYear`](https://calendar-widgets.com/helpers/getCalendarYear) function
38+
- [`listCalendarYear`](https://calendar-widgets.com/helpers/listCalendarYear) function
3939
- [`listDaysInMonth`](https://calendar-widgets.com/helpers/listDaysInMonth) function
40+
- `listLocalizedMonths` function
4041

4142
### Utilities
4243
- [`formatDate`](https://calendar-widgets.com/utilities/formatDate) function

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
"install:docs": "cd ./workspaces/docs && pnpm install",
1616
"install:tests": "cd ./workspaces/tests && pnpm install",
1717
"install:calendar-widgets": "cd ./workspaces/calendar-widgets && pnpm install",
18-
"new": "pnpm run install:tests && pnpm run install:calendar-widgets && pnpm run install:docs"
18+
"new": "pnpm run install:tests && pnpm run install:calendar-widgets && pnpm run install:docs",
19+
"lint:calendar-widgets": "cd ./workspaces/calendar-widgets && pnpm run lint",
20+
"lint:fix:calendar-widgets": "cd ./workspaces/calendar-widgets && pnpm run lint:fix",
21+
"build:tests": "cd ./workspaces/tests && pnpm run build:tests",
22+
"build:prepublish": "pnpm run build:tests && pnpm run lint:calendar-widgets"
1923
}
2024
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export declare function formatDate(month: number, day: number, year: number, locale?: string, options?: Intl.DateTimeFormatOptions): string;
2+
export declare function listCalendarYear(year: number, locale: string): { [key: string]: string[] };
3+
export declare function getDaysInMonth(year: number, month: number): number;
4+
export declare function listDaysInMonth(year: number, month: number): string[];
5+
export declare function isValidYear(year: number): boolean;
6+
export declare function isValidDay(day: number): boolean;
7+
export declare function isValidMonth(month: number): boolean;
8+
export declare function Hello(): void;

workspaces/calendar-widgets/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ pnpm install calendar-widgets
2626
Once the package is installed, you'll have access to an array of helpers and utilities that do a lot of the heavy lifting when it comes to dates and calendars.
2727

2828
### Helpers
29-
- [`getCalendarYear`](https://calendar-widgets.com/helpers/getCalendarYear) function
29+
- [`listCalendarYear`](https://calendar-widgets.com/helpers/listCalendarYear) function
3030
- [`listDaysInMonth`](https://calendar-widgets.com/helpers/listDaysInMonth) function
31-
31+
- `listLocalizedMonths` function
3232
### Utilities
3333
- [`formatDate`](https://calendar-widgets.com/utilities/formatDate) function
3434
- [`getDaysInMonth`](https://calendar-widgets.com/utilities/getDaysInMonth) function

workspaces/calendar-widgets/package.json

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "calendar-widgets",
3-
"version": "0.0.9",
3+
"version": "0.0.10",
44
"main": "./dist/bundle.js",
55
"type": "module",
66
"module": "./src/index.js",
7+
"types": "@types/calendar-widgets/index.d.ts",
78
"scripts": {
89
"lint": "eslint -c .eslintrc.cjs ./src --ext .ts,.tsx",
910
"lint:debug": "eslint -c .eslintrc.cjs ./src --ext .ts,.tsx --debug",
@@ -12,7 +13,8 @@
1213
},
1314
"keywords": [
1415
"calendar",
15-
"calendar SDK"
16+
"calendar SDK",
17+
"calendar widgets"
1618
],
1719
"dependencies": {
1820
"react": "18.2.0",
@@ -36,5 +38,13 @@
3638
"tslib": "^2.5.0",
3739
"typescript": "^5.0.4"
3840
},
39-
"license": "MIT"
41+
"license": "MIT",
42+
"repository": {
43+
"type": "git",
44+
"url": "https://github.com/9mbs/calendar-widgets"
45+
},
46+
"bugs": {
47+
"url": "https://github.com/9mbs/calendar-widgets/issues"
48+
},
49+
"homepage": "https://www.calendar-widgets.com/"
4050
}

workspaces/calendar-widgets/src/utils/getCalendarYear.ts workspaces/calendar-widgets/src/helpers/listCalendarYear.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { listDaysInMonth } from './listDaysInMonth.js';
2-
import { isValidYear } from './isValidYear.js';
2+
import { isValidYear } from '../utils/isValidYear.js';
33
import { locale as localeConstants } from '../locale/index.js';
44
import { ONE } from '../constants.js';
55

@@ -9,7 +9,7 @@ import { ONE } from '../constants.js';
99
* @param {number} year - The year for which to generate the calendar (e.g. 2023).
1010
* @returns {object} An object representing a calendar year with a list of days for each month.
1111
*/
12-
export const getCalendarYear = (year: number, locale = 'en-US') => {
12+
export const listCalendarYear = (year: number, locale = 'en-US'): { [key: string]: string[] } => {
1313
if (!isValidYear(year)) {
1414
throw new Error('Invalid year, must be between 1900 and 2100.');
1515
}

workspaces/calendar-widgets/src/utils/listDaysInMonth.ts workspaces/calendar-widgets/src/helpers/listDaysInMonth.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ONE, ZERO } from '../constants';
2-
import { formatDate } from './formatDate';
3-
import { isValidMonth } from './isValidMonth';
4-
import { isValidYear } from './isValidYear';
2+
import { formatDate } from '../utils/formatDate';
3+
import { isValidMonth } from '../utils/isValidMonth';
4+
import { isValidYear } from '../utils/isValidYear';
55

66
/**
77
* Generates an array of formatted date strings representing each day in a given month and year.
+7-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
import { getDaysInMonth } from './utils/getDaysInMonth';
22
import { isValidYear } from './utils/isValidYear';
3-
import { listDaysInMonth } from './utils/listDaysInMonth';
3+
import { listDaysInMonth } from './helpers/listDaysInMonth';
44
import { locale } from './locale/index';
5-
import { getCalendarYear } from './utils/getCalendarYear';
5+
import { listCalendarYear } from './helpers/listCalendarYear';
66
import { formatDate } from './utils/formatDate';
77
import { isValidDay } from './utils/isValidDay';
88
import { isValidMonth } from './utils/isValidMonth';
9+
import { listLocalizedMonths } from './helpers/listLocalizedMonths';
910
import { Hello } from './components/Hello';
1011

1112
export {
12-
getDaysInMonth,
1313
listDaysInMonth,
14-
locale,
15-
getCalendarYear,
14+
listCalendarYear,
15+
listLocalizedMonths,
16+
getDaysInMonth,
1617
formatDate,
1718
isValidYear,
1819
isValidDay,
1920
isValidMonth,
21+
locale,
2022
Hello
2123
};

workspaces/docs/docs/Helpers/getCalendarYear.mdx workspaces/docs/docs/Helpers/listCalendarYear.mdx

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
---
2-
title: getCalendarYear
3-
slug: /helpers/getCalendarYear
2+
3+
title: listCalendarYear
4+
slug: /helpers/listCalendarYear
45
---
56

67
import {ArgDescriptor} from '../../src/components/ArgDescriptor';
78

8-
# `getCalendarYear`
9+
# `listCalendarYear`
910

10-
The getCalendarYear function generates an object representing a calendar year with a list of days for each month.
11+
The listCalendarYear function generates an object representing a calendar year with a list of days for each month.
1112

1213
## Usage Example
14+
1315
```js
14-
import { getCalendarYear } from 'calendar-widgets';
16+
import { listCalendarYear } from 'calendar-widgets';
1517

16-
const calendar = getCalendarYear(2023);
18+
const calendar = listCalendarYear(2023);
1719
console.log(calendar);
1820
/*
1921
Output:

workspaces/docs/docs/changelog.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1111

1212
## [Unreleased]
1313

14+
## 0.0.10
15+
16+
### Changed
17+
- [Changed `getCalendarYear` to `listCalendarYear`](https://github.com/9mbs/calendar-widgets/issues/130)
1418
- [Changed build output from `es` to `umd` for better support](https://github.com/9mbs/calendar-widgets/issues/120)
15-
- [Added React to Rollup configuration for module bundling](https://github.com/9mbs/calendar-widgets/issues/121)
19+
- [Changed ESLint Rules](https://github.com/9mbs/calendar-widgets/issues/97). Thanks, [@giri-madhan](https://github.com/giri-madhan)
20+
21+
### Added
1622
- [Added new method `listLocalizedMonths`](https://github.com/9mbs/calendar-widgets/issues/121)
23+
- [Added MIT License to NPM package](https://github.com/9mbs/calendar-widgets/issues/125). Thanks, [@bajibpathan](https://github.com/bajibpathan)!
24+
- [Added React to Rollup configuration for module bundling](https://github.com/9mbs/calendar-widgets/issues/121)
1725

18-
## 0.0.8
26+
## 0.0.8 & 0.0.9
1927

2028
### Added
2129

workspaces/docs/docs/introduction.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ pnpm install calendar-widgets
3333
Once the package is installed, you'll have access to an array of helpers and utilities that do a lot of the heavy lifting when it comes to dates and calendars.
3434

3535
## Helpers
36-
- [`getCalendarYear`](helpers/getCalendarYear) function
36+
- [`listCalendarYear`](helpers/listCalendarYear) function
3737
- [`listDaysInMonth`](helpers/listDaysInMonth) function
38+
- `listLocalizedMonths` function
3839

3940
## Utilities
4041
- [`formatDate`](utilities/formatDate) function

workspaces/docs/docs/road-map.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ slug: /road-map
1010
**Goal:** Launch the `calendar-widgets` SDK for production use. Develop three slightly opinionated React-based widgets, including the Calendar Widget, Interactive Calendar Widget, and Draggable Timeline Widget, while localizing the interfaces and documentation for each widget.
1111

1212
- [ ] Lift helpers and utilities for use in Production
13-
- [ ] [`getCalendarYear`](helpers/getCalendarYear) function
13+
- [ ] [`listCalendarYear`](helpers/listCalendarYear) function
1414
- [ ] [`listDaysInMonth`](helpers/listDaysInMonth) function
1515
- [ ] [`formatDate`](utilities/formatDate) function
1616
- [ ] [`getDaysInMonth`](utilities/getDaysInMonth) function

workspaces/tests/pnpm-lock.yaml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

workspaces/tests/tests/helpers/getCalendarYear.test.js workspaces/tests/tests/helpers/listCalendarYear.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/** Dependencies */
22
import {
3-
getCalendarYear,
3+
listCalendarYear,
44
listDaysInMonth,
55
locale
66
} from 'calendar-widgets';
77

8-
describe('getCalendarYear', () => {
8+
describe('listCalendarYear', () => {
99
it('should throw an Error for an invalid year', () => {
1010
const invalidYear = 1850;
11-
expect(() => getCalendarYear(invalidYear)).toThrow(Error, 'Invalid year, must be between 1900 and 2100.');
11+
expect(() => listCalendarYear(invalidYear)).toThrow(Error, 'Invalid year, must be between 1900 and 2100.');
1212
});
1313

1414
it('should return a calendar object for a valid year', () => {
1515
const validYear = 2022;
16-
const result = getCalendarYear(validYear);
16+
const result = listCalendarYear(validYear);
1717
expect(result).toBeInstanceOf(Object);
1818

1919
for (let month = 1; month <= 12; month++) {

0 commit comments

Comments
 (0)