Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matteocollina/160cefac2b97de7c314cce87f8ec9872 to your computer and use it in GitHub Desktop.
Save matteocollina/160cefac2b97de7c314cce87f8ec9872 to your computer and use it in GitHub Desktop.
//It works only for iOS, with Android i can't set picker with intervals
onDateChange={(date)=>{
if(this.state.dateMode == "time" && this.state.minuteInterval){
let hours = Number(String(date).split(":")[0])
let minutes = Number(String(date).split(":")[1])
let diff = minutes % this.state.minuteInterval
if(diff != 0){
date = (String(hours)+":"+String(minutes-diff))
}
}
this.onChangeDate(date)
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment