Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatePicker no default value and misses months for future "max" year on 1st drop down #10710

Closed
trakhimenok opened this issue Mar 9, 2017 · 3 comments

Comments

@trakhimenok
Copy link

Ionic version: (check one with "x")
[x] 2.x

I'm submitting a ... (check one with "x")
[x] bug report
[x] feature request

Current behavior:

If max attribute specified into future for example "2020-12-31" the date picker would display:

  • Day: {1}
  • Month: {unselected but list starts with today's month, currently March}
  • Year - {the max one, for this example 2020}.

If I scroll the year to 2019 and back to 2020 all 12 months are shown as expected.

Expected behavior:

Regards bug: I expect either max year with all 12 months (or up to the last allowed by max) or a current year to be selected by default (or first allowed by min property)

Regards feature request: I suggest we have additional property defaultValue.

Reasoning: I want some of my date fields to be optional so I can't fill the value before the picker clicked but once user opens drop down I want a specific date to be preselected, specifically I need today or tomorrow but could be any arbitrary date. Also for optional fields would be nice to have some way to clear the field from previously entered value.

Steps to reproduce:
See plunker: http://plnkr.co/edit/H7eMFjSDrj8VbsUo0bDW?p=preview

Related code:

<ion-list>
    <ion-item>
			<ion-label>Due on</ion-label>
			<ion-datetime
			  displayFormat="D MMMM YYYY"
			  pickerFormat="D MMMM YYYY"
			  min="2017-03-08"
			  max="2020-12-31"
			  ></ion-datetime>
    </ion-item>
  </ion-list>
</

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.1 
ios-sim version: 5.0.11 
OS: OS X El Capitan
Node Version: v6.7.0
Xcode version: Xcode 8.2.1 Build version 8C1002
@rapropos
Copy link
Contributor

rapropos commented Mar 9, 2017

Looks like a partial dupe of 9846 to me.

@jgw96
Copy link
Contributor

jgw96 commented Mar 13, 2017

Thanks for opening an issue with us, going to merge this with #9846.

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 3, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants