GithubHelp home page GithubHelp logo

abhi-dave / addatepicker Goto Github PK

View Code? Open in Web Editor NEW
169.0 169.0 26.0 3.18 MB

A fully customizable iOS Horizontal PickerView library, written in pure swift

License: MIT License

Ruby 13.81% Objective-C 1.09% Swift 85.10%

addatepicker's People

Contributors

abhi-dave avatar pratik-sodha avatar sameer4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

addatepicker's Issues

App crash on 31 March

From debugging..it seems days model does't contain 31
so

let d = days.index { (modelObj) -> Bool in return Int(modelObj.type) == Int(dd) }

gives nil and crashes on days[d!].isSelected = true

Returning incorrect date (previous day in my case) for timezones other than GMT

The issue happens in devices in timezones other that GMT. The returned day is the previous day of the day picked by the user. That happens because when converting the date string to Date the timezone is not taken into account (DateFormatter assumes 00:00 for GMT). And if your timezone is not GMT when using or visualising the Date it is converted to YOUR timezone and if it is for example GMT-1, you date has been changed to the previous day at 23:00.

How to fix? The following change fixed the issue for me.
In CalendarHelper.swift change:

let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MM/dd/yyyy"
if currentDay == "" {
       currentDay = (days.last?.type)!
}
let date = dateFormatter.date(from: "\(currentMonth)/\(currentDay)/\(currentYear)")

to

let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MM/dd/yyyy"
if currentDay == "" {
       currentDay = (days.last?.type)!
}
dateFormatter.locale = Locale.current // Added line
dateFormatter.timeZone = TimeZone(secondsFromGMT: 0) // Added line
let date = dateFormatter.date(from: "\(currentMonth)/\(currentDay)/\(currentYear)")

Happy NewYear

class func getYears(startYear: Int = 1980, endYear: Int = 2018) ;

I recommend changing the default value of endYear of the method func getYears(startYear:Int = 1980,endYear:Int = 2018) to the current year, otherwise it will crash if there is no age range set.

Error if iOS device preferred device language other than English

Error if iOS device preferred device language other than English.

Easy t test, just switch language from device Settings > General > Language & Region > Make any other language first on Preferred Language order.

Date picker will report error "Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value!" in CalendarHelper.swift "return date!" line 89

Feature Request: Limit scrolling of days by range of days before and after current date

I'd like to be able to limit the number of days we can scroll.

For example +/- 3 days from today (August 25th)

func limitScrollingOfDays(daysBefore before: Int, daysAfter after: Int, from selectedDate) {
    //TODO: Logic here
}

And be used like:

datePicker.limitScrollingOfDays(daysBefore: 3, daysAfter: 10, from: Date())

It should limit the number of scrolling days from August 22nd to September 4th

Leap year date issue

i have found an issue on leap year. after launching it current date. i am trying to move the year section (2016) and then month section (feb). after that i have found that 29th is selected but not moved to the selected area of the picker. this happen when our first launching current date is like 31-03-20
screen shot 2018-08-28 at 4 30 24 pm
screen shot 2018-08-28 at 4 32 07 pm

Strange issue with miss-aligned labels.

It seems the labels are miss-aligned. I've used Arial 16points font.
Maybe some calculation issues with a reminder? We did not check the code :)

Screenshot 2020-02-28 at 4 11 48 PM

Would be nice to find a fix for this bug ๐Ÿ‘

Feature request: Choose which elements to display and add weekdays as a new element

I'd like to be able to display weekdays inside the scrolls and decide if I want to display for example year or maybe number of days

Something like:

MON | TUE | WED | THUR | FRI | SAT | SUN
   1     |    2   |    3    |     4        5   |    6   |    7
JAN   | ....

And a method like:

func displayElements(_ elements: [ElementType]) {
    //Logic here
}

That would be called like:

datePicker.displayElements([.weekday, .day, .month])

The code above would display weekdays, days and months

While this one below would display only months and years:

datePicker.displayElements([.month, .year])

Need just month and year picker

I Need a just month and year picker...i was thinking to give some -ve top dates section get hidden :D but not working...so can i have it as feature like a fixed height from user and then he can control what to show or option to make picker just for month and year

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.