Skip to content

Commit 248142e

Browse files
committed
update readme, changelog
1 parent 0e72cd1 commit 248142e

File tree

6 files changed

+142
-107
lines changed

6 files changed

+142
-107
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## 3.0.0
8+
9+
### Changed
10+
11+
- Project development taken over by iROOMit Inc!
12+
- All components rewritten in TypeScript
13+
- Class components converted to functional components
14+
- Rewrote all PropTypes declarations as TypeScript type definitions
15+
- `date-fns` dependency upgraded to v3
16+
- `Webpack` upgraded to v5
17+
- Upgraded `Babel`, `Jest`, `React` dependencies to latest versions
18+
- Removed `shallow-equal` dependency in favour of built-in `JSON.stringify()`
19+
20+
### To Do
21+
22+
- Convert demo project to TypeScript
23+
- Convert tests to TypeScript
24+
25+
Going forward, any changes should reference cooresponding commit IDs. Because this version marks a takeover and entire rewrite of the project, commit IDs have been omitted due to various changes taking place over several commits.
26+
27+
**This should not be a breaking release. All previous props and components from this library are still valid after the TypeScript rewrite.**
28+
729
## 1.4.0
830

931
### Added

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# @iroomit/react-date-range
2-
[![npm](https://img.shields.io/npm/v/react-date-range)](https://www.npmjs.com/package/react-date-range)
3-
[![npm](https://img.shields.io/npm/l/react-date-range)]()
4-
[![npm](https://img.shields.io/npm/dw/react-date-range)](https://www.npmjs.com/package/react-date-range)
5-
[![sponsors](https://img.shields.io/github/sponsors/hypeserver)](https://github.com/sponsors/hypeserver)
2+
[![npm](https://img.shields.io/npm/v/@iroomit/react-date-range)](https://www.npmjs.com/package/@iroomit/react-date-range)
3+
[![npm](https://img.shields.io/npm/l/@iroomit/react-date-range)]()
4+
[![npm](https://img.shields.io/npm/dw/@iroomit/react-date-range)](https://www.npmjs.com/package/react-date-range)
65

76

87
A date library agnostic React component for choosing dates and date ranges. Uses [date-fns](http://date-fns.org/) for date operations.
@@ -11,7 +10,9 @@ A date library agnostic React component for choosing dates and date ranges. Uses
1110

1211
This awesome project is a fork of the original [react-date-range](https://github.com/hypeserver/react-date-range) by hypeserver.
1312

14-
This fork aims at keeping this project alive. Dependencies have been upgraded, class components updated to function components and the entire project has been rewritten in TypeScript. Some of the code has also been optimized further with newer React features.
13+
This fork aims at keeping this project alive!
14+
15+
Dependencies have been upgraded, class components updated to function components and the entire project has been rewritten in TypeScript. Some of the code has also been optimized further with newer React features.
1516

1617
### Why should you use `@iroomit/react-date-range`?
1718

@@ -22,11 +23,11 @@ This fork aims at keeping this project alive. Dependencies have been upgraded, c
2223
- Based on native js dates
2324
- Drag n Drop selection
2425
- Keyboard friendly
25-
- TypeScript support
26+
- Built-in TypeScript support
2627

27-
**Live Demo :** [http://hypeserver.github.io/react-date-range](http://hypeserver.github.io/react-date-range)
28+
**Live Demo :** [http://iroomitapp.github.io/react-date-range](http://iroomitapp.github.io/react-date-range)
2829

29-
![](https://raw.githubusercontent.com/hypeserver/react-date-range/master/demo/ss.png)
30+
![](https://raw.githubusercontent.com/iroomitapp/react-date-range/master/demo/ss.png)
3031

3132

3233
## Getting Started
@@ -55,6 +56,12 @@ This plugin expects `react` and `date-fns` as peerDependencies, It means that yo
5556
npm install react date-fns
5657
```
5758

59+
or
60+
61+
```
62+
yarn add react date-fns
63+
```
64+
5865
## Usage
5966

6067
You need to import skeleton and theme styles first.
@@ -162,8 +169,8 @@ startDatePlaceholder | String | `Early` | Start Date
162169
endDatePlaceholder | String | `Continuous` | End Date Placeholder
163170
fixedHeight | Boolean | false | Since some months require less than 6 lines to show, by setting this prop, you can force 6 lines for all months.
164171
renderStaticRangeLabel(`DefinedRange`)| Function | | Callback function to be triggered for the static range configurations that have `hasCustomRendering: true` on them. Instead of rendering `staticRange.label`, return value of this callback will be rendered.
165-
staticRanges(`DefinedRange`, `DateRangePicker`) | Array | [default preDefined ranges](https://github.com/hypeserver/react-date-range/blob/master/src/defaultRanges.js) | -
166-
inputRanges(`DefinedRange`, `DateRangePicker`) | Array | [default input ranges](https://github.com/hypeserver/react-date-range/blob/master/src/defaultRanges.js) | -
172+
staticRanges(`DefinedRange`, `DateRangePicker`) | Array | [default preDefined ranges](https://github.com/iroomitapp/react-date-range/blob/master/src/defaultRanges.ts) | -
173+
inputRanges(`DefinedRange`, `DateRangePicker`) | Array | [default input ranges](https://github.com/iroomitapp/react-date-range/blob/master/src/defaultRanges.ts) | -
167174
ariaLabels | Object | {} | inserts aria-label to inner elements
168175
dayContentRenderer | Function | null | Function to customize the rendering of Calendar Day. given a date is supposed to return what to render.
169176

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@iroomit/react-date-range",
3-
"version": "3.0.0-alpha.1",
3+
"version": "3.0.0-alpha.2",
44
"description": "A React component for choosing dates and date ranges.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -81,7 +81,7 @@
8181
"postcss": "^8.2.13",
8282
"postcss-cli": "^11.0.0",
8383
"postcss-import": "^16.0.0",
84-
"postcss-loader": "^7.3.4",
84+
"postcss-loader": "^8.0.0",
8585
"prettier": "^3.1.1",
8686
"react": "^18.0.0",
8787
"react-docgen-typescript": "^2.2.2",

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export { default as DateRange } from './components/DateRange';
2-
export { default as Calendar } from './components/Calendar';
3-
export { default as DateRangePicker } from './components/DateRangePicker';
1+
export { default as DateRange, type DateRangeProps } from './components/DateRange';
2+
export { default as Calendar, type CalendarProps } from './components/Calendar';
3+
export { default as DateRangePicker, type DateRangePickerProps } from './components/DateRangePicker';
44
export { default as DefinedRange } from './components/DefinedRange';
55
export { defaultInputRanges, defaultStaticRanges, createStaticRanges } from './defaultRanges';

src/utils.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@ import { DateRange } from './components/DayCell';
1414

1515
export function calcFocusDate(currentFocusedDate: Date, shownDate?: Date, date?: Date, months?: number, ranges?: DateRange[], focusedRange?: number[], displayMode?: "dateRange" | "date") {
1616
// find primary date according the props
17-
let targetInterval;
17+
let targetInterval: DateRange;
1818
if (displayMode === 'dateRange') {
1919
const range = ranges[focusedRange[0]];
2020
targetInterval = {
21-
start: range?.startDate,
22-
end: range?.endDate,
21+
startDate: range?.startDate,
22+
endDate: range?.endDate,
2323
};
2424
} else {
2525
targetInterval = {
26-
start: date,
27-
end: date,
26+
startDate: date,
27+
endDate: date,
2828
};
2929
}
30-
targetInterval.start = startOfMonth(targetInterval.start || new Date());
31-
targetInterval.end = endOfMonth(targetInterval.end || targetInterval.start);
32-
const targetDate = targetInterval.start || targetInterval.end || shownDate || new Date();
30+
targetInterval.startDate = startOfMonth(targetInterval.startDate || new Date());
31+
targetInterval.endDate = endOfMonth(targetInterval.endDate || targetInterval.startDate);
32+
const targetDate = targetInterval.startDate || targetInterval.endDate || shownDate || new Date();
3333

3434
// initial focus
3535
if (!currentFocusedDate) return shownDate || targetDate;
3636

3737
// // just return targetDate for native scrolled calendars
3838
// if (scroll.enabled) return targetDate;
39-
if (differenceInCalendarMonths(targetInterval.start, targetInterval.end) > months) {
39+
if (differenceInCalendarMonths(targetInterval.startDate, targetInterval.endDate) > months) {
4040
// don't change focused if new selection in view area
4141
return currentFocusedDate;
4242
}

0 commit comments

Comments
 (0)