FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: DatePicker month off by 1 in Android by vakrilov · Pull Request #4872 · NativeScript/NativeScript · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ts  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
18 changes: 18 additions & 0 deletions tests/app/ui/date-picker/date-picker-tests.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

Back | FazBrowse Home | New Git URL