NativeScript: Android: DatePicker shows wrong month

Tell us about the problem

For 9th and 10th months DatePicker shows October.

screen shot 2017-09-19 at 6 12 10 pm

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.1.3
  • Cross-platform modules: 3.2.0
  • Runtime(s): 3.2.0
  • Genymotion Android 7.1.0 Samsung Galaxy S7

Please tell us how to recreate the issue in as much detail as possible.

Here is the repo demonstrating the bug: https://github.com/terreb/ns-datepicker

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

/app/main-page.xml

<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
    <StackLayout>
        <DatePicker day="1" month="9" year="2017" verticalAlignment="center"/>
        <DatePicker day="1" month="10" year="2017" verticalAlignment="center"/>
    </StackLayout>
</Page>

/app/App_Resources/Android/values-v21/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- Application theme -->
    <style name="AppTheme" parent="AppThemeBase">
        <item name="android:datePickerStyle">@style/SpinnerDatePicker</item>
        <item name="android:timePickerStyle">@style/SpinnerTimePicker</item>
    </style>

    <!-- Default style for DatePicker - in spinner mode -->
    <style name="SpinnerDatePicker" parent="android:Widget.Material.Light.DatePicker">
        <item name="android:datePickerMode">spinner</item>
    </style>

    <!-- Default style for TimePicker - in spinner mode -->
    <style name="SpinnerTimePicker" parent="android:Widget.Material.Light.TimePicker">
        <item name="android:timePickerMode">spinner</item>
    </style>

    <style name="NativeScriptToolbarStyle" parent="NativeScriptToolbarStyleBase">
        <item name="android:elevation">4dp</item>
    </style>
</resources>

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Hi @vakrilov, thank you for the explanation and I confirm the issue is fixed after I changed to “tns-core-modules”: “3.3.0-2017-10-18-3”.

Hi @tsonevn, are you kidding? Do you really think that September is 9th month (no problem here) and November is 10th?! Should I set

<DatePicker day="1" month="9.5" year="2017" verticalAlignment="center"/>

for October then;)