Advertisement
Guest User

Untitled

a guest
Jul 8th, 2018
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. if (Platform.OS === 'ios') {
  2. this.setState({ datePickerIosPlatform: true })
  3. } else {
  4. try {
  5. const { action, year, month, day } = await DatePickerAndroid.open({
  6. date: new Date()
  7. });
  8. if (action !== DatePickerAndroid.dismissedAction) {
  9. console.log('action', action, 'year', year, ' month', month, 'day', day)
  10. var stringDate = `${year} ${month} ${day}`;
  11. var newDate = new Date(stringDate)
  12. alert(newDate)
  13.  
  14. var convertDate = moment(newDate).format();
  15. console.log('convertdata',convertDate)
  16.  
  17. // this.convertDate(stringDate)
  18. }
  19. } catch ({ code, message }) {
  20. console.warn('Cannot open date picker', message);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement