Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
simple-react-date-selector
Advanced tools
A simple react date picker component.
Preview:
Default styling:
Custom styling:
Props:
Prop | Required | Type | Description |
---|---|---|---|
onChange | true | function | The callback function that should be executed when the complete date is chosen. The argument is the date value that is returned. |
onOpened | false | function | The callback function that should be executed as soon as the datepicker becomes visible |
onClosed | false | function | The callback function that should be executed as soon as the datepicker is hidden |
placeholder | true | string | The field label |
value | true | string | The current value that should be displayed in the date field. |
headerStyles | false | style object | Additional styles that should be added to the header - The day, month and year headings |
bodyStyles | false | style object | Additional styles that should be added to the body - The day, month and year options |
containerStyles | false | style object | Additional styles that should be added to the container - The modal in which the day, month and year pickers are rendered |
footerStyles | false | style object | Additional styles that should be added to the footer - The footer that displays the currently selected year, month and day |
visible | false | boolean | You can programmatically set the visibility of the datepicker by specifying true (show the datepicker) or false (hide the datepicker) |
yearRange | false | object | Set the from and to year range. For example {from:2000,to:2015}. By default the range is from 15 years in the past to 15 years in the future |
Steps for including the component in your project:
Example usage:
Add the SCSS file to your application's root SCSS file - for example:
/*Remember to reference your node_modules directory correctly*/
@import "../node_modules/simple-react-date-selector/styles/simple-react-date-selector";
Add it to your application's component - for example:
import React,{Component} from "react";
/*This is a default export so feel free to name it whatever you like. It doesn't have to be Datepicker */
import Datepicker from 'simple-react-date-selector';
export default class MyComponent extends Component{
constructor(props){
super(props);
this.state={DateFrom:"",DateTo:""};
}
/*
The first datepicker simply has the default styling
The second datepicker component has been given custom styling
*/
render(){
return (
<Datepicker
onChange={date=>{this.setState({DateFrom:date})}}
placeholder={'From'}
value={this.state.DateFrom}
visible={true}
/>
<Datepicker
onChange={date=>{this.setState({DateTo:date})}}
placeholder={'To'}
value={this.state.DateTo}
headerStyles={{
backgroundColor:'#263238',
color:'white',
borderBottomWidth:0
}}
containerStyles={{
borderRadius:0,
backgroundColor:'#263238',
borderColor:'black',
borderWidth:1,
borderStyle:'solid'
}}
bodyStyles={{
borderRadius:10,
backgroundColor:'white',
borderWidth:1,
borderColor:'#263238',
borderStyle:'solid'
}}
footerStyles={{
borderRadius:0,
borderWidth:1,
borderColor:'#263238',
borderStyle:'solid'
}}
/>
)
}
}
FAQs
A simple date picker for ReactJS
We found that simple-react-date-selector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.