katemihalikova / ion-datetime-picker

Date and/or time picker for awesome Ionic framework
MIT License
169 stars 101 forks source link

Default value in pop up datetime. #85

Closed Alkasih closed 7 years ago

Alkasih commented 7 years ago

I am sorry, I have one more question please. It is so wierd when the popup showing the current datetime when I need to edit it. How to make it only 00:00 if the value is not set yet, and only show the real value if it has been set, so it doesn't look for the curent datetime.

Thank you very much

katemihalikova commented 7 years ago

You should initialize your model value to 00:00 in your controller. The picker is not choosing any values on its own, but always uses ng-model. The only exception is when ng-model is not a valid Date instance, it is set to new Date().

Alkasih commented 7 years ago

The ng-model has value 10:15 perfectly in console log, but when I click it to edit, the pop up start the time as the current time in my dekstop computer which is 1:41

Alkasih commented 7 years ago

Please help me to fix it. Please...

katemihalikova commented 7 years ago

Only Date instances are supported as model values.

Alkasih commented 7 years ago

Here is the code pen when I change the model to H:mm

http://codepen.io/alkasih/pen/mOqbOP

Alkasih commented 7 years ago

For this project what I need is only hour and minutes, so I don't need date to input. Any idea to help me please?

katemihalikova commented 7 years ago

new Date(0, 0, 0, 10, 15)

Alkasih commented 7 years ago

var mytime = '12:30'; new Date(0, 0, 0, 10, 15);

How do I convert it?

katemihalikova commented 7 years ago

new Date(0, 0, 0, 12, 30)

Alkasih commented 7 years ago

:D It is so static. It should be dynamic.

katemihalikova commented 7 years ago

Sorry but this is super simple task for any, even sub-par programmer. Do you want to hire me?

Alkasih commented 7 years ago

It is ok, I can handle it.