0

I am now using default UIDatePicker which show only date in my UIDatePicker view.The point is, I want to limit my datepicker for showing with range and disable every sunday from that picker cause I am creating auction app.Auction close on sunday,so I need to hide every sunday in my UIDatePicker.Also I want to show from unlimited date from past to current date only.

Simple,

1.Setting date range from (unlimited date which was past to current date only) [....dd/MM/yyyy to...current date only]

2.When I show a datepicker,I dont want to display sunday in that UIDatePicker.

Here is what I have in java code

Map<String, String> auctionDate = new LinkedHashMap<String, String>();

    SimpleDateFormat sdfDDMMYYYYEEE = new SimpleDateFormat("dd/MM/yyyy (EEE)");
    SimpleDateFormat sdfDDMMYYYY = new SimpleDateFormat("dd/MM/yyyy");
    SimpleDateFormat sdfEEE = new SimpleDateFormat("EEE");
    for (int i = 0; i < 5; i++) {
        if (sdfEEE.format(now).equals("Sun")) {
            now.setTime(now.getTime() + 86400000);
            i--;
            continue;
        }
        auctionDate.put(sdfDDMMYYYY.format(now), sdfDDMMYYYYEEE.format(now));
        now.setTime(now.getTime() + 86400000);
    }

Is there anyway I can set this in Swift?Thank you...

1
  • You can create your own UIPickerView and set the data source manually, or you could do something like this. Simply check for [components day] Commented Jul 6, 2015 at 8:05

1 Answer 1

1

You will need to create your own UIPickerView for doing this. There is no method with which you can remove Sundays from a UIDatePicker. What you can do instead is when the user selects a date, check whether its a Sunday. If it is, select the next date by default.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.