From e24d98f90f111a488afb6533165349ade6cdccef Mon Sep 17 00:00:00 2001 From: tgpetrov Date: Thu, 27 Jun 2019 09:47:25 +0300 Subject: [PATCH 1/2] refactor: use not so generic names --- src/ui/picker-field-base.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ui/picker-field-base.ts b/src/ui/picker-field-base.ts index 231cc46..8071c70 100644 --- a/src/ui/picker-field-base.ts +++ b/src/ui/picker-field-base.ts @@ -8,7 +8,7 @@ export abstract class PickerFieldBase extends TextField { public pickerOkText: string; public pickerCancelText: string; - private _tapHandler: (args: TouchGestureEventData) => void; + private _pickerFieldBaseTapHandler: (args: TouchGestureEventData) => void; constructor() { super(); @@ -36,11 +36,11 @@ export abstract class PickerFieldBase extends TextField { initNativeView() { super.initNativeView(); - this._updateHandler(true); + this._updatePickerFieldBaseTapHandler(true); } disposeNativeView() { - this._updateHandler(false); + this._updatePickerFieldBaseTapHandler(false); super.disposeNativeView(); } @@ -51,18 +51,18 @@ export abstract class PickerFieldBase extends TextField { protected onLocaleChanged(oldValue: string, newValue: string) { } - private _updateHandler(subscribe: boolean) { + private _updatePickerFieldBaseTapHandler(subscribe: boolean) { if (subscribe) { - this._tapHandler = this._tapHandler || ((args: TouchGestureEventData) => { - this._onTap(args); + this._pickerFieldBaseTapHandler = this._pickerFieldBaseTapHandler || ((args: TouchGestureEventData) => { + this._onPickerFieldBaseTap(args); }); - this.on(GestureTypes.tap, this._tapHandler); + this.on(GestureTypes.tap, this._pickerFieldBaseTapHandler); } else { - this.off(GestureTypes.tap, this._tapHandler); + this.off(GestureTypes.tap, this._pickerFieldBaseTapHandler); } } - private _onTap(args: TouchGestureEventData) { + private _onPickerFieldBaseTap(args: TouchGestureEventData) { this.open(); } } From 87ff1ffd9434fa662fe84b8e33c66f4b77d0d6e7 Mon Sep 17 00:00:00 2001 From: tgpetrov Date: Thu, 27 Jun 2019 09:48:13 +0300 Subject: [PATCH 2/2] docs: more details about formats --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 15a2699..956fe3b 100644 --- a/README.md +++ b/README.md @@ -165,12 +165,12 @@ Internally `DatePickerField` and `TimePickerField` call `DateTimePicker`'s `pick | Property | Description | | --- | --- | -| `date` | The date the picker field is currently displaying. | -| `minDate` | The minimum date the picker field can select. | -| `maxDate` | The maximum date the picker field can select. | +| `date` | The date the picker field is currently displaying. Property is of type `Date`. When used in markup, the provided string will be passed to the [Date constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) to create a new `Date` object. | +| `minDate` | The minimum date the picker field can select. Parsing of dates is handled similarly as with `date` property. | +| `maxDate` | The maximum date the picker field can select. Parsing of dates is handled similarly as with `date` property. | | `locale` | Identifier of a locale that will be used to localize the names of the month names and also the order of the spinners (with `en_GB` first spinner is day, with `en_US` first spinner is month) (default is based on the device’s locale settings). | | `dateFormat` | Format used for the text in the picker field (on android used as a pattern for a [SimpleDateFormat](https://developer.android.com/reference/java/text/SimpleDateFormat), on iOS used as a dateFormat for [NSDateFormatter](https://developer.apple.com/documentation/foundation/nsdateformatter), default is generated by the current value of the `locale` property). | -| `pickerDefaultDate` | The date that will be displayed in the picker, if it is opened while date is undefined (if `pickerDefaultDate` is undefined, the picker will display today) | +| `pickerDefaultDate` | The date that will be displayed in the picker, if it is opened while date is undefined (if `pickerDefaultDate` is undefined, the picker will display today). Parsing of dates is handled similarly as with `date` property. | | `pickerTitle` | Text that will be displayed as title of the picker, default is undefined. | | `pickerOkText` | Text for the confirmation button of the picker (default is OK on iOS, localized version of OK on android (based on the devices locale settings)). | | `pickerCancelText` | Text for the cancel button of the picker (default is Cancel on iOS, localized version of Cancel on android (based on the devices locale settings)). | @@ -179,10 +179,10 @@ Internally `DatePickerField` and `TimePickerField` call `DateTimePicker`'s `pick | Property | Description | | --- | --- | -| `time` | The time the picker field is currently displaying. | +| `time` | The time the picker field is currently displaying. Property is of type `Date`. When used in markup, the provided string will be parsed to a new `Date` object if it is in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Times) format. | | `locale` | Identifier of a locale that will be used to create locale-specific time formatter of the time (if the format is 12-Hour, with de_DE locale “vorm.”/”nachm.” will be used to show whether time is before/after noon, with en_US locale “am”/”pm” will be used) (default is based on the device’s locale settings). The locale will also be used on iOS to determine whether the picker will be in 12 or 24 hour format. | | `timeFormat` | Format used for the text in the picker field (on android used as a pattern for a [SimpleDateFormat](https://developer.android.com/reference/java/text/SimpleDateFormat), on iOS used as a dateFormat for [NSDateFormatter](https://developer.apple.com/documentation/foundation/nsdateformatter), default is generated by the current value of the locale property), the format will also be used on Android to determine whether the picker will be in 12 or 24 hour format. | -| `pickerDefaultTime` | The time that will be displayed in the picker, if it is opened while time is undefined (if defaultTime is undefined, the picker will display now). | +| `pickerDefaultTime` | The time that will be displayed in the picker, if it is opened while time is undefined (if defaultTime is undefined, the picker will display now). Parsing is handled similarly as with `time` property. | | `pickerTitle` | Text that will be displayed as title of the picker, default is undefined. | | `pickerOkText` | Text for the confirmation button of the picker (default is OK on iOS, localized version of OK on android (based on the devices locale settings)). | | `pickerCancelText` | Text for the cancel button of the picker (default is Cancel on iOS, localized version of Cancel on android (based on the devices locale settings)). | @@ -191,13 +191,13 @@ Internally `DatePickerField` and `TimePickerField` call `DateTimePicker`'s `pick | Property | Description | | --- | --- | -| `date` | The date the picker fields are currently displaying. | -| `minDate` | The minimum date the date component can select. | -| `maxDate` | The maximum date the time component can select. | +| `date` | The date the picker fields are currently displaying. Property is of type `Date`. When used in markup, the provided string will be passed to the [Date constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) to create a new `Date` object. | +| `minDate` | The minimum date the date component can select. Parsing of dates is handled similarly as with `date` property. | +| `maxDate` | The maximum date the time component can select. Parsing of dates is handled similarly as with `date` property. | | `locale` | Identifier of a locale that will be used to localize the names of the month names, the order of the date spinners (with `en_GB` first spinner is day, with `en_US` first spinner is month), and to create locale-specific time formatter of the time (if the format is 12-Hour, with de_DE locale “vorm.”/”nachm.” will be used to show whether time is before/after noon, with en_US locale “am”/”pm” will be used) (default is based on the device’s locale settings). The locale will also be used on iOS to determine whether the picker will be in 12 or 24 hour format. | | `dateFormat` | Format used for the text in the picker field (on android used as a pattern for a [SimpleDateFormat](https://developer.android.com/reference/java/text/SimpleDateFormat), on iOS used as a dateFormat for [NSDateFormatter](https://developer.apple.com/documentation/foundation/nsdateformatter), default is generated by the current value of the `locale` property). | | `timeFormat` | Format used for the text in the picker field (on android used as a pattern for a [SimpleDateFormat](https://developer.android.com/reference/java/text/SimpleDateFormat), on iOS used as a dateFormat for [NSDateFormatter](https://developer.apple.com/documentation/foundation/nsdateformatter), default is generated by the current value of the locale property), the format will also be used on Android to determine whether the picker will be in 12 or 24 hour format. | -| `pickerDefaultTime` | The time that will be displayed in the picker, if it is opened while time is undefined (if defaultTime is undefined, the picker will display now). | +| `pickerDefaultDate` | The date and time that will be displayed in the pickers, if opened while `date` is `undefined` (if `pickerDefaultDate` is undefined, the picker will display now). Parsing of dates is handled similarly as with `date` property. | | `pickerTitleDate` | Text that will be displayed as title of the picker, when the date component is tapped, default is undefined. | | `pickerTitleTime` | Text that will be displayed as title of the picker, when the time component is tapped, default is undefined. | | `pickerOkText` | Text for the confirmation button of the picker (default is OK on iOS, localized version of OK on android (based on the devices locale settings)). |