**UPDATED**
I got tired of waiting and did the following:
- Downloaded your zip file.
- Downloaded original project.
- Created folder with this content:
- 1_DatePicker-master - Original code you mentioned in first post.
- 2_help me - Your code. Not sure how you run this.
- 3_example - A copy of ‘1_DatePicker-master’ that has been modified to show past and future years.
Code is attached below.
I only show the past 10 and future 10 years.
I edited datePickerWheel.lua and changed this:
-- Add the last 100 years. local years = {} local currYear = tonumber(os.date("%Y")) + 1 for i = 100, 1, -1 do years[i] = currYear - i end
to this:
-- Add the past 10 years and the next 10 years. 100 years is going to make the control very bloated. local yearsBeforeAfter = 10 local years = {} local currYear = tonumber(os.date("%Y")) + 1 + yearsBeforeAfter for i = (2\*yearsBeforeAfter), 1, -1 do years[i] = currYear - i end
I then edited example.lua
changing this:
if time \> os.time() then native.showAlert("Date Picker", "You cannot choose a date in the future.", {"OK"}) return false end
to this:
--[[if time \> os.time() then native.showAlert("Date Picker", "You cannot choose a date in the future.", {"OK"}) return false end --]]