Coder Social home page Coder Social logo

logisticinfotech / react-native-datetimepicker Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 5.0 1.26 MB

React Native horizontal date picker

Home Page: https://www.logisticinfotech.com/blog/react-native-horizontal-date-picker-library/

License: MIT License

JavaScript 74.28% Python 6.98% Java 4.79% Objective-C 13.96%
react-native react-native-datetime-picker datetimepicker horizontal-datetime-picker react-native-demo react reactnativedemo reactnative-ios datepicker timepicker

react-native-datetimepicker's Issues

is there a way that i can select minutes too ?

I am able to select time using this param onTimeSelected={this.onTimeSelected}, is there any way that i can display the minutes in the multiples of 5 and select the minutes, i hope there is a way
Thanks.

minDate is not working

i am setting minDate but it doesnt work, and even in your example its not there can u help me out here. its throwing warning as Warning: Failed prop type: Invalid prop 'minDate' of type 'Object' supplied to 'HorizontalDatePicker'

How to limit the time

Hi, is it possible to set minTime and maxTime in the current version? As of right now, it shows time from 00:00 to 23:00 and I want to limit it to 09:00 to 17:00.

I am getting the following warnings even though i am using the correct methods

Screenshot 2019-10-27 at 12 11 17 PM

here's the code i have written

export default class CustomDatePicker extends Component {
  constructor(props) {
    super(props);
    this.state = {
      date1: '',
      time1: '',
      dateTime1: '',
      date2: '',
      time2: '',
      dateTime2: '',
      date3: '',
      time3: '',
      dateTime3: '',
    };
  }

  onDateSelected = date => {
    // setTimeout(()=>{}, 5000);
    this.setState({
      date1: date,
      date2: moment(date, 'DD-MM-YYYY').format('DD MMM YYYY'),
      date3: moment(date, 'DD-MM-YYYY').format('Do MMMM YYYY'),
    });
  };

  onTimeSelected = time => {
    this.setState({
      time1: time,
      time2: moment(time, 'hh:mm a').format('HH:mm'),
      time3: moment(time, 'hh:mm a').format('HH:mm a'),
    });
  };

  onDateTimeSelected = datetime => {
    // format="MMMM Do YYYY, h:mm:ss a"
    this.setState({
      dateTime1: datetime.datetime,
      dateTime2: moment(datetime.datetime, 'DD-MM-YYYY hh:mm a').format('DD MMM YYYY 

HH:mm'),
dateTime3: moment(datetime.datetime, 'DD-MM-YYYY hh:mm a').format('MMMM Do YYYY, h:mm:ss a'),
});
};
render() {
const { date1, date2, date3, time1, time2, time3, dateTime1, dateTime2, dateTime3 } =
this.state;
return (


<HorizontalDatePicker
datePickerContainerStyle={{backgroundColor: 'white'}}
timePickerContainerStyle={{backgroundColor: 'white'}}
yearContainerStyle={{backgroundColor: 'white'}}
yearTextStyle={{color: '#31588A', paddingLeft: 200}}
unSelectedTextStyle={[{color: '#31588A'}]}
selectedTextStyle={{color: '#EACF79'}}
onDateSelected={this.onDateSelected}
onTimeSelected={this.onTimeSelected}
onDateTimeSelected={this.onDateTimeSelected}
/>


<Text style={[styles.instructions, styles.textColor1]}>{date1}
<Text style={[styles.instructions, styles.textColor1]}>{time1}
<Text style={[styles.instructions, styles.textColor1]}>{dateTime1}


<Text style={[styles.instructions, styles.textColor2]}>{date2}
<Text style={[styles.instructions, styles.textColor2]}>{time2}
<Text style={[styles.instructions, styles.textColor2]}>{dateTime3}


<Text style={[styles.instructions, styles.textColor3]}>{date3}
<Text style={[styles.instructions, styles.textColor3]}>{time3}
<Text style={[styles.instructions, styles.textColor3]}>{dateTime3}



);
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.