| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ export function getNativeYear(datePicker: datePickerModule.DatePicker): number { | |||
| 5 | 5 | } | |
| 6 | 6 | ||
| 7 | 7 | export function getNativeMonth(datePicker: datePickerModule.DatePicker): number { | |
| 8 | - return datePicker.android.getMonth() + 1; | ||
| 8 | + return datePicker.android.getMonth(); | ||
| 9 | 9 | } | |
| 10 | 10 | ||
| 11 | 11 | export function getNativeDay(datePicker: datePickerModule.DatePicker): number { | |
@@ -25,13 +25,13 @@ export function setNativeYear(datePicker: datePickerModule.DatePicker, value: nu | |||
| 25 | 25 | } | |
| 26 | 26 | ||
| 27 | 27 | export function setNativeMonth(datePicker: datePickerModule.DatePicker, value: number): void { | |
| 28 | - datePicker.android.updateDate(datePicker.android.getYear(), value - 1, datePicker.android.getDayOfMonth()); | ||
| 28 | + datePicker.android.updateDate(datePicker.android.getYear(), value, datePicker.android.getDayOfMonth()); | ||
| 29 | 29 | } | |
| 30 | 30 | ||
| 31 | 31 | export function setNativeDay(datePicker: datePickerModule.DatePicker, value: number): void { | |
| 32 | 32 | datePicker.android.updateDate(datePicker.android.getYear(), datePicker.android.getMonth(), value); | |
| 33 | 33 | } | |
| 34 | 34 | ||
| 35 | 35 | export function setNativeDate(datePicker: datePickerModule.DatePicker, year: number, month: number, day: number): void { | |
| 36 | - datePicker.android.updateDate(year, month - 1, day); | ||
| 36 | + datePicker.android.updateDate(year, month, day); | ||
| 37 | 37 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,7 @@ export function getNativeYear(datePicker: datePickerModule.DatePicker): number { | |||
| 7 | 7 | } | |
| 8 | 8 | ||
| 9 | 9 | export function getNativeMonth(datePicker: datePickerModule.DatePicker): number { | |
| 10 | - return utils.ios.getter(NSCalendar, NSCalendar.currentCalendar).componentsFromDate(NSCalendarUnit.CalendarUnitYear | NSCalendarUnit.CalendarUnitMonth | NSCalendarUnit.CalendarUnitDay, datePicker.ios.date).month; | ||
| 10 | + return utils.ios.getter(NSCalendar, NSCalendar.currentCalendar).componentsFromDate(NSCalendarUnit.CalendarUnitYear | NSCalendarUnit.CalendarUnitMonth | NSCalendarUnit.CalendarUnitDay, datePicker.ios.date).month - 1; | ||
| 11 | 11 | } | |
| 12 | 12 | ||
| 13 | 13 | export function getNativeDay(datePicker: datePickerModule.DatePicker): number { | |
@@ -31,7 +31,7 @@ export function setNativeYear(datePicker: datePickerModule.DatePicker, value: nu | |||
| 31 | 31 | ||
| 32 | 32 | export function setNativeMonth(datePicker: datePickerModule.DatePicker, value: number): void { | |
| 33 | 33 | var comps = utils.ios.getter(NSCalendar, NSCalendar.currentCalendar).componentsFromDate(NSCalendarUnit.CalendarUnitYear | NSCalendarUnit.CalendarUnitMonth | NSCalendarUnit.CalendarUnitDay, datePicker.ios.date); | |
| 34 | - comps.month = value; | ||
| 34 | + comps.month = value + 1; | ||
| 35 | 35 | datePicker.ios.setDateAnimated(utils.ios.getter(NSCalendar, NSCalendar.currentCalendar).dateFromComponents(comps), false); | |
| 36 | 36 | (<any>datePicker)._changeHandler.valueChanged(datePicker.ios); | |
| 37 | 37 | } | |
@@ -46,7 +46,7 @@ export function setNativeDay(datePicker: datePickerModule.DatePicker, value: num | |||
| 46 | 46 | export function setNativeDate(datePicker: datePickerModule.DatePicker, year: number, month: number, day: number): void { | |
| 47 | 47 | var comps = utils.ios.getter(NSCalendar, NSCalendar.currentCalendar).componentsFromDate(NSCalendarUnit.CalendarUnitYear | NSCalendarUnit.CalendarUnitMonth | NSCalendarUnit.CalendarUnitDay, datePicker.ios.date); | |
| 48 | 48 | comps.year = year; | |
| 49 | - comps.month = month; | ||
| 49 | + comps.month = month + 1; | ||
| 50 | 50 | comps.day = day; | |
| 51 | 51 | datePicker.ios.setDateAnimated(utils.ios.getter(NSCalendar, NSCalendar.currentCalendar).dateFromComponents(comps), false); | |
| 52 | 52 | (<any>datePicker)._changeHandler.valueChanged(datePicker.ios); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,13 +95,13 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke | |||
| 95 | 95 | ||
| 96 | 96 | public test_WhenCreated_DayIsCurrentDay() { | |
| 97 | 97 | const actualValue = this.testView.day; | |
| 98 | - const expectedValue = currentDate.getDay(); | ||
| 98 | + const expectedValue = currentDate.getDate(); | ||
| 99 | 99 | TKUnit.assertEqual(actualValue, expectedValue); | |
| 100 | 100 | } | |
| 101 | 101 | ||
| 102 | 102 | public test_WhenCreated_DateIsCurrentDate() { | |
| 103 | 103 | const expectedValue = currentDate; | |
| 104 | - assertDate(this.testView, expectedValue.getFullYear(), expectedValue.getMonth(), expectedValue.getDay()); | ||
| 104 | + assertDate(this.testView, expectedValue.getFullYear(), expectedValue.getMonth(), expectedValue.getDate()); | ||
| 105 | 105 | } | |
| 106 | 106 | ||
| 107 | 107 | public testYearFromLocalToNative() { | |
@@ -129,10 +129,11 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke | |||
| 129 | 129 | const today = new Date(2016, 3, 15); | |
| 130 | 130 | this.testView.year = today.getFullYear(); | |
| 131 | 131 | this.testView.month = today.getMonth(); | |
| 132 | + | ||
| 132 | 133 | const expectedValue = today.getDate(); | |
| 133 | 134 | this.testView.day = expectedValue; | |
| 134 | 135 | ||
| 135 | - const expectedDate = new Date(today.getFullYear(), today.getMonth() - 1, expectedValue); | ||
| 136 | + const expectedDate = new Date(today.getFullYear(), today.getMonth(), expectedValue); | ||
| 136 | 137 | TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed."); | |
| 137 | 138 | TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed."); | |
| 138 | 139 | TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed."); | |
@@ -145,7 +146,7 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke | |||
| 145 | 146 | ||
| 146 | 147 | const expectedValue = today.getMonth(); | |
| 147 | 148 | this.testView.month = expectedValue; | |
| 148 | - const expectedDate = new Date(today.getFullYear(), expectedValue - 1, today.getDate()); | ||
| 149 | + const expectedDate = new Date(today.getFullYear(), expectedValue, today.getDate()); | ||
| 149 | 150 | ||
| 150 | 151 | TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed."); | |
| 151 | 152 | TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed."); | |
@@ -159,7 +160,7 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke | |||
| 159 | 160 | ||
| 160 | 161 | const expectedValue = 1980; | |
| 161 | 162 | this.testView.year = expectedValue; | |
| 162 | - const expectedDate = new Date(1980, current.getMonth() - 1, current.getDate()); | ||
| 163 | + const expectedDate = new Date(1980, current.getMonth(), current.getDate()); | ||
| 163 | 164 | ||
| 164 | 165 | TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed."); | |
| 165 | 166 | TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed."); | |
@@ -217,7 +218,7 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke | |||
| 217 | 218 | ||
| 218 | 219 | datePickerTestsNative.setNativeDate(this.testView, today.getFullYear(), today.getMonth(), expectedValue); | |
| 219 | 220 | ||
| 220 | - const expectedDate = new Date(today.getFullYear(), today.getMonth() - 1, expectedValue); | ||
| 221 | + const expectedDate = new Date(today.getFullYear(), today.getMonth(), expectedValue); | ||
| 221 | 222 | TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed."); | |
| 222 | 223 | TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed."); | |
| 223 | 224 | TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed."); | |
@@ -229,7 +230,7 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke | |||
| 229 | 230 | ||
| 230 | 231 | datePickerTestsNative.setNativeDate(this.testView, today.getFullYear(), expectedValue, today.getDate()); | |
| 231 | 232 | ||
| 232 | - const expectedDate = new Date(today.getFullYear(), expectedValue - 1, today.getDate()); | ||
| 233 | + const expectedDate = new Date(today.getFullYear(), expectedValue, today.getDate()); | ||
| 233 | 234 | TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed."); | |
| 234 | 235 | TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed."); | |
| 235 | 236 | TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed."); | |
@@ -241,7 +242,7 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke | |||
| 241 | 242 | const expectedValue = 1981; | |
| 242 | 243 | datePickerTestsNative.setNativeDate(this.testView, expectedValue, today.getMonth(), today.getDate()); | |
| 243 | 244 | ||
| 244 | - const expectedDate = new Date(expectedValue, today.getMonth() - 1, today.getDate()); | ||
| 245 | + const expectedDate = new Date(expectedValue, today.getMonth(), today.getDate()); | ||
| 245 | 246 | TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed."); | |
| 246 | 247 | TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed."); | |
| 247 | 248 | TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed."); | |
@@ -253,7 +254,7 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke | |||
| 253 | 254 | const testDay = 24; | |
| 254 | 255 | ||
| 255 | 256 | datePickerTestsNative.setNativeDate(this.testView, testYear, testMonth, testDay); | |
| 256 | - const expectedDate = new Date(testYear, testMonth - 1, testDay); | ||
| 257 | + const expectedDate = new Date(testYear, testMonth, testDay); | ||
| 257 | 258 | TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed."); | |
| 258 | 259 | TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed."); | |
| 259 | 260 | TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed."); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments