weilsonwonder / WWCalendarTimeSelector

A android inspired iOS date/time picker
MIT License
317 stars 126 forks source link

Selected date/time always four hours ahead #54

Closed akmalshukri closed 6 years ago

akmalshukri commented 6 years ago

func WWCalendarTimeSelectorDone(_ selector: WWCalendarTimeSelector, date: NSDate) { print("Selected \n(date)\n---") singleDate = date as Date }

or

func WWCalendarTimeSelectorDone(_ selector: WWCalendarTimeSelector, date: Date) { print("Selected \n(date)\n---") singleDate = date }

got the same issue .. How to solve this issue ?

nizzam commented 6 years ago

Have you fixed this issue @akmalshukri ?

akmalshukri commented 6 years ago

@nizzam Yes, already solve the issue ..

nizzam commented 6 years ago

@akmalshukri do you mind to share your solutions ?

akmalshukri commented 6 years ago

I just play with trick .. You put this one in that func

let calendar = NSCalendar.autoupdatingCurrent singleDate = calendar.date(byAdding:.hour, value: -4, to: date as Date)! print("Selected \n(singleDate)\n---")

It will reduce 4 hours ..