react-tailwindcss-datetimepicker
Advanced tools
Comparing version 2.0.3 to 2.0.4
{ | ||
"name": "react-tailwindcss-datetimepicker", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -96,3 +96,3 @@ # 📦 React TailwindCSS Date and Time Picker | ||
// Check out section "Installing With TailwindCSS" in docs. | ||
import "react-tailwindcss-datetimepicker/style.css"; | ||
import "react-tailwindcss-datetimepicker/style.css"; | ||
@@ -143,9 +143,9 @@ const startOfToday = moment(new Date()) | ||
```tsx | ||
import React from "react"; | ||
import DateTimePicker from "react-tailwindcss-datetimepicker"; | ||
import moment, { type Moment } from "moment"; | ||
import React from 'react'; | ||
import DateTimePicker from 'react-tailwindcss-datetimepicker'; | ||
import moment, { type Moment } from 'moment'; | ||
// If you are already using TailwindCSS, you can omit this. | ||
// Check out section "Installing With TailwindCSS" in docs. | ||
import "react-tailwindcss-datetimepicker/style.css"; | ||
import 'react-tailwindcss-datetimepicker/style.css'; | ||
@@ -162,3 +162,3 @@ interface Props {} | ||
); | ||
const endOfToday = moment(startOfToday).add(1, "days").subtract(1, "seconds"); | ||
const endOfToday = moment(startOfToday).add(1, 'days').subtract(1, 'seconds'); | ||
@@ -171,4 +171,4 @@ class App extends React.Component<Props, State> { | ||
this.state = { | ||
start: moment(new Date()).subtract(2, "days"), | ||
end: moment(new Date()).add(1, "days").subtract(1, "seconds"), | ||
start: moment(new Date()).subtract(2, 'days'), | ||
end: moment(new Date()).add(1, 'days').subtract(1, 'seconds'), | ||
}; | ||
@@ -189,4 +189,4 @@ } | ||
Today: [moment(startOfToday), moment(endOfToday)], | ||
"Last 30 Days": [ | ||
moment(startOfToday).subtract(1, "months"), | ||
'Last 30 Days': [ | ||
moment(startOfToday).subtract(1, 'months'), | ||
moment(endOfToday), | ||
@@ -217,4 +217,4 @@ ], | ||
| [`end`](#end) | **Required** | `Moment Date` | `undefined` | Initial end Date set in the picker | | ||
| [`locale`](#locale) | **Required** | `Object` | `undefined` | locale format for date labels | | ||
| [`applyCallback`](#applycallback) | **Required** | `Function` | `null` | Function which is called when the apply button is clicked | | ||
| [`locale`](#locale) | optional | `Object` | `undefined` | locale format for date labels | | ||
| [`rangeCallback`](#rangecallback) | optional | `Function` | `null` | Function which is called when one of the preset ranges is clicked | | ||
@@ -244,9 +244,11 @@ | [`maxDate`](#maxdate) | optional | `Moment Date` | `undefined` | Maximum date that can be selected in calendar | | ||
```js | ||
const startOfToday = moment(new Date()) | ||
.set('hour', 0) | ||
.set('minute', 0) | ||
.set('second', 0); | ||
const endOfToday = moment(startOfToday).add(1, 'days').subtract(1, 'second'); | ||
const ranges = { | ||
Today: [moment(start), moment(end)], | ||
Yesterday: [ | ||
moment(start).subtract(1, 'days'), | ||
moment(end).subtract(1, 'days'), | ||
], | ||
'Last 3 Days': [moment(start).subtract(3, 'days'), moment(end)], | ||
Today: [startOfToday, startOfToday], | ||
'Last 30 Days': [moment(startOfToday).subtract(1, 'months'), startOfToday], | ||
}; | ||
@@ -269,2 +271,8 @@ ``` | ||
### `applyCallback` | ||
(Required) `(start: Moment, end: Moment) => void` | ||
Function which is called when the apply button is clicked/pressed. Takes two params, start date and the end date which are both `Moment` dates. | ||
### `locale` | ||
@@ -274,3 +282,3 @@ | ||
Defines a locale format for date labels to be shown as. Can also set Sunday to be first day or Monday. | ||
Defines a locale format for date labels to be shown as. Can also set Sunday to be first day or Monday. | ||
@@ -309,8 +317,2 @@ Example: | ||
### `applyCallback` | ||
(Required) `(start: Moment, end: Moment) => void` | ||
Function which is called when the apply button is clicked/pressed. Takes two params, start date and the end date which are both `Moment` dates. | ||
### `rangeCallback` | ||
@@ -317,0 +319,0 @@ |
374773
484