You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
A date and time picker in the same React.js component. It can be used as a datepicker, timepicker or both at the same time. It is **highly customizable** and it even allows to edit date's milliseconds.
7
7
8
-
> **Back to the roots!** Thanks to the people of [YouCanBook.me (best scheduling tool)](https://youcanbook.me) for sponsoring react-datetime for so long. Now the project returns to the community and we are **looking for collaborators** to continue improving react-datetime. [Would you like to give a hand?](contribute-home.md)
8
+
> **Back to the roots!** Thanks to the people of [YouCanBook.me (best scheduling tool)](https://youcanbook.me) for sponsoring react-datetime for so long. Now the project returns to the community and we are **looking for contributors** to continue improving react-datetime. [Would you like to give a hand?](contribute-home.md)
9
9
10
10
These are the docs for version 3 of the library. If you are still using the deprecated v2, [here it is its documentation](https://github.com/arqex/react-datetime/blob/2a83208452ac5e41c43fea31ef47c65efba0bb56/README.md), but we strongly recommend to migrate to version 3 in order to keep receiving updates. Please check [migrating react-datetime to version 3](migrateToV3.md) to safely update your app.
11
11
@@ -25,20 +25,21 @@ yarn add react-datetime
25
25
26
26
[React.js](http://facebook.github.io/react/) and [Moment.js](http://momentjs.com/) are peer dependencies for react-datetime (as well as [Moment.js timezones](https://momentjs.com/timezone/) if you want to use the `displayTimeZone` prop). These dependencies are not installed along with react-datetime automatically, but your project needs to have them installed in order to make the datepicker work. You can then use the datepicker like in the example below.
27
27
28
-
29
28
```js
29
+
// Import the library
30
30
importDatetimefrom'react-datetime';
31
31
32
-
...
33
-
34
-
render:function() {
35
-
return<Datetime />;
36
-
}
32
+
// return it from your components
33
+
return<Datetime />;
37
34
```
38
35
[See this example working](https://codesandbox.io/s/boring-dew-uzln3).
39
36
37
+
Do you want more examples? [Have a look at our resources gallery](resources.md).
38
+
40
39
**Don't forget to add the [CSS stylesheet](https://github.com/arqex/react-datetime/blob/master/css/react-datetime.css) to make it work out of the box.**
41
40
41
+
42
+
42
43
## API
43
44
44
45
Below we have all the props that we can use with the `<DateTime>` component. There are also some methods that can be used imperatively.
@@ -225,15 +226,15 @@ class MyDTPicker extends React.Component {
225
226
this.refs.datetime.navigate("days");
226
227
}
227
228
}
228
-
[See it working](https://codesandbox.io/s/frosty-fog-nrwk2)
229
229
```
230
+
[See it working](https://codesandbox.io/s/frosty-fog-nrwk2)
230
231
231
232
#### Method Parameters
232
233
*`props` is the object that the datepicker has calculated for this object. It is convenient to use this object as the `props` for your custom component, since it knows how to handle the click event and its `className` attribute is used by the default styles.
233
234
*`selectedDate` and `currentDate` are [moment objects](http://momentjs.com) and can be used to change the output depending on the selected date, or the date for the current day.
234
235
*`month` and `year` are the numeric representation of the current month and year to be displayed. Notice that the possible `month` values range from `0` to `11`.
235
236
236
-
## Specify Available Units
237
+
## Make it work as a year picker or a time picker
237
238
You can filter out what you want the user to be able to pick by using `dateFormat` and `timeFormat`, e.g. to create a timepicker, yearpicker etc.
238
239
239
240
In this example the component is being used as a *timepicker* and can *only be used for selecting a time*.
@@ -248,7 +249,7 @@ In this example you can *only select a year and month*.
248
249
```
249
250
[Working example of only selecting year and month here.](https://codesandbox.io/s/recursing-pascal-xl643)
250
251
251
-
## Selectable Dates
252
+
## Blocking some dates to be selected
252
253
It is possible to disable dates in the calendar if the user are not allowed to select them, e.g. dates in the past. This is done using the prop `isValidDate`, which admits a function in the form `function(currentDate, selectedDate)` where both arguments are [moment objects](http://momentjs.com). The function shall return `true` for selectable dates, and `false` for disabled ones.
253
254
254
255
In the example below are *all dates before today* disabled.
Copy file name to clipboardExpand all lines: contribute-home.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,15 @@
2
2
3
3
Hey!! So good you are interested in collaborate with react-datetime, I'm pretty sure you can make the difference here!
4
4
5
-
react-datetime is a nice choice if you are looking for some open-source project to lay your hands on. It's a library used by thousands of developers, and the changes in the last version make easier for everyone to understand it. It's not simple, but it's small enough to be get you initiated in a couple of hours.
5
+
react-datetime is a nice choice if you are looking for some open-source project to lay your hands on. It's a library **used by thousands of developers**, and the changes in the last version make easier for everyone to understand it. It's not simple, but it's small enough to be get you initiated in a couple of hours.
6
6
7
7
## Do you want to be part of the future of react-datetime?
8
8
We've just released the version 3 of the library and we are already planning the version 4, why don't you join the conversation and help defining the roadmap:
9
9
10
10
*[Defining version 4 of react-datetime](https://github.com/arqex/react-datetime/issues/723)
11
11
12
12
## Do you want to play with the source code?
13
-
Best way of understand anything is by doing it! This repository includes a playground to let you make changes to the library in minutes. Clone the repo and fire up the playground:
13
+
Best way of understand anything is by experiencing it! This repository includes a playground to let you make changes to the library in minutes. Clone the repo and fire up the playground:
Copy file name to clipboardExpand all lines: migrateToV3.md
+2-16Lines changed: 2 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,20 +55,6 @@ Version 3 is a big refactor of react-datetime. We have tried to not to change th
55
55
* Updated most of the dependencies.
56
56
57
57
## Contribute
58
+
react-datetime is made by the community for the community. People like you, interested in contribute, are the key of the project! 🙌🙌🙌
58
59
59
-
react-datetime is a nice choice if you are looking for some open-source project to lay your hands on. It's a library used by thousands of developers, and the changes in this version make easier for everyone to understand it. It's not simple, but it's small enough to be get you initiated in a couple of hours.
60
-
61
-
If you are interested and want to start playing with its code, clone it and fire up the playground included in the repo:
This will start a local development server building `src/index.js`. We can update react-datetime's sources then and our changes will be hot loaded by the development server.
71
-
72
-
Looking for something to work on? Have a look at [the list of known issues](https://github.com/arqex/react-datetime/issues), and maybe you can kill a bug making somebody happy! :)
73
-
74
-
Have some work done? That's great! But please, read the [react-datetime contributing guidelines](.github/CONTRIBUTING.md) before submitting it.
60
+
Have a look at [our contribute page](contribute-home.md) to know how to get started.
0 commit comments