@olenbetong/date-navigator
React component used to navigate dates.
Last updated 10 days ago by bjornarvh .
MIT · Original npm · Tarball · package.json
$ cnpm install @olenbetong/date-navigator 
SYNC missed versions from official npm registry.

@olenbetong/date-navigator

React component used to navigate dates.

Installation

NPM:

npm i @olenbetong/date-navigator
import { DateNavigator, StatefulDateNavigator } from '@olenbetong/date-navigator';

UMD and ESM builds are available on unpkg.com. For UMD, the components are available in the global ReactDateNavigator variable.

<script src="https://unpkg.com/@olenbetong/date-navigator@latest/dist/umd/date-navigate.min.js" type="text/javascript"></script>
<script type="text/javascript">
const { DateNavigator, StatefulDateNavigator } = ReactDateNavigator;
</script>
<script type="module">
import { DateNavigator, StatefulDateNavigator } from "https://unpkg.com/@olenbetong/date-navigator@latest/dist/esm/date-navigate.min.js";
</script>

Usage

Use the DateNavigator component if you wish to control the date state yourself.

class MyComponent extends React.Component {
	state = {
		date: new Date()
	};

	handleDateChanged(date) {
		this.setState({ date });
	}

	render() {
		return <DateNavigator onChange={(date) => this.handleDateChanged(date)} date={this.state.date}/>
	}
}

If you don't need to control the date yourself, the StatefulDateNavigator is a small wrapper around the DateNavigator component that will keep the date in its state. You can pass an initial date value to it.

function handleDateChanged(date) {
	dsSomeDataSource.setParameter('filterString', `[Date] = '${date.toISOString()}'`);
	dsSomeDataSource.refreshDataSource();
}

ReactDOM.render(
	<StatefulDateNavigator onChange={handleDateChanged} initialDate={yesterday}/>,
	document.querySelector('#DateNavigator');
)

Current Tags

  • 1.0.34                                ...           latest (10 days ago)

29 Versions

  • 1.0.34                                ...           10 days ago
  • 1.0.33                                ...           2 months ago
  • 1.0.32                                ...           2 months ago
  • 1.0.31                                ...           5 months ago
  • 1.0.29                                ...           5 months ago
  • 1.0.28                                ...           6 months ago
  • 1.0.27                                ...           6 months ago
  • 1.0.26                                ...           6 months ago
  • 1.0.25                                ...           6 months ago
  • 1.0.24                                ...           6 months ago
  • 1.0.21                                ...           7 months ago
  • 1.0.20                                ...           7 months ago
  • 1.0.19                                ...           7 months ago
  • 1.0.18                                ...           7 months ago
  • 1.0.17                                ...           8 months ago
  • 1.0.16                                ...           9 months ago
  • 1.0.15                                ...           9 months ago
  • 1.0.14                                ...           9 months ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           a year ago
  • 1.0.10                                ...           a year ago
  • 1.0.9                                ...           a year ago
  • 1.0.8                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 42
Last Day 0
Last Week 14
Last Month 19
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |