nativescript-angular
nativescript-angular copied to clipboard
Cannot set minute or hour to 0 for TimePicker on Android
Environment
Provide version numbers for the following components (information can be retrieved by running tns info
in your project folder or by inspecting the package.json
of the project):
- CLI: Description of value source needed in bug template
- Cross-platform modules: Description of value source needed in bug template
- Android Runtime: 5.3.1
- iOS Runtime:
- Plugin(s): Description of value source needed in bug template
- NativeScript-Angular: 6.2.0
- Angular: 6.1.10
Describe the bug I am referencing the following issue because it perfectly describes the problem, but was closed on the assumption that the bug was fixed without being validated:
https://github.com/nativescript-vue/nativescript-vue/issues/148
To Reproduce See the above issue.
Expected behavior Setting all values in the range 0 to 59 should be possible for the minute value, but setting to zero is being treated as a case to ignore the value
Sample project None
Additional context
Hi @lonerzzz, I checked the described case, however, was unable to recreate the issue. I tested setting the minutes for the TimePicker via UI and code-behind and in both cases, the minutes were set correctly to zero. Check out the sample project here.
Your implementation provides one way to get it working, but someting about the implementation is currently brittle to the initialization. I have updated your code with a version 2. For me, the minutes are neither correct on startup nor when the button is pressed:
https://play.nativescript.org/?template=play-ng&id=3e8b92&v=2
I have subsequently determined that the time cannot be 12:00 AM. A zero is not allowed in the hour position either in certain cases:
https://play.nativescript.org/?template=play-ng&id=3e8b92&v=3
This seems to be a Nativescript core issue, as I just noticed it happens with Vue too.
If you run the example you'll see neither the minute nor the hour are set to 0. Every value other than 0 works. https://play.nativescript.org/?template=play-vue&id=Xz1XRK
Workaround: If you set it to new Number('0')
it will work
@tsonevn Can you check if the Vue playground above works for you (the minute/hour should be showing 0 instead of the current minute/hour)?
If it is working for you it might be a device-specific problem. If it is not working it's a core issue and has nothing to do with nativescript-angular either, as this happens with all flavours. For NS core there is already on open issue here: https://github.com/NativeScript/NativeScript/issues/8941
This is still not working, the playground project provided here does not set the values to 0. In my case it is Nativescript Angular.
Closed via https://github.com/NativeScript/NativeScript/pull/10460