This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@olenbetong/react-date-navigate

1.0.1 • Public • Published

react-date-select

React component used to navigate dates.

Installation

An UMD build is published to the global component 'modules/umd/date-select.min.js' and can be included with a script tag. The components are available in the global ReactDateSelect variable.

<script src="/file/component/modules/umd/date-select.min.js" type="text/javascript"></script>
<script type="text/javascript">
const { DateSelect, StatefulDateSelect } = ReactDateSelect;
</script>

If using dynamic imports, there is an ESM build available.

const { importModule } = ob.utils;
const module = '/file/component/modules/esm/date-select.min.js';
const { DateSelect, StatefulDateSelect } = await importModule(module);

Usage

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

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

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

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

If you don't need to control the date yourself, the StatefulDateSelect is a small wrapper around the DateSelect 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(
	<StatefulDateSelect onChange={handleDateChanged} initialDate={yesterday}/>,
	document.querySelector('#dateSelect');
)

Readme

Keywords

Package Sidebar

Install

npm i @olenbetong/react-date-navigate

Weekly Downloads

4

Version

1.0.1

License

ISC

Unpacked Size

39.9 kB

Total Files

15

Last publish

Collaborators

  • bjornarvh