mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
fix: DatePicker month off by 1 in Android (#4872)
This commit is contained in:

committed by
GitHub

parent
6d7c1ff295
commit
1e47117179
@ -99,6 +99,24 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
|
||||
TKUnit.assertEqual(actualValue, expectedValue);
|
||||
}
|
||||
|
||||
public test_WhenCreated_NativeYearIsCurrentYear() {
|
||||
const actualValue = datePickerTestsNative.getNativeYear(this.testView);
|
||||
const expectedValue = currentDate.getFullYear();
|
||||
TKUnit.assertEqual(actualValue, expectedValue);
|
||||
}
|
||||
|
||||
public test_WhenCreated_NativeMonthIsCurrentMonth() {
|
||||
const actualValue = datePickerTestsNative.getNativeMonth(this.testView);
|
||||
const expectedValue = currentDate.getMonth() + 1;
|
||||
TKUnit.assertEqual(actualValue, expectedValue);
|
||||
}
|
||||
|
||||
public test_WhenCreated_NativeDayIsCurrentDay() {
|
||||
const actualValue = datePickerTestsNative.getNativeDay(this.testView);;
|
||||
const expectedValue = currentDate.getDate();
|
||||
TKUnit.assertEqual(actualValue, expectedValue);
|
||||
}
|
||||
|
||||
public testYearFromLocalToNative() {
|
||||
const expectedValue = 1980;
|
||||
this.testView.year = expectedValue;
|
||||
|
@ -59,7 +59,7 @@ export class DatePicker extends DatePickerBase {
|
||||
picker.setCalendarViewShown(false);
|
||||
const listener = new DateChangedListener(this);
|
||||
|
||||
picker.init(this.year, this.month, this.day, listener);
|
||||
picker.init(this.year, this.month - 1, this.day, listener);
|
||||
(<any>picker).listener = listener;
|
||||
return picker;
|
||||
}
|
||||
|
Reference in New Issue
Block a user