The error was because DateField needs a StringDateFormatter.

I added a dateFormat property to DateField and fixed the example.

I also added the separator sooner, so after typing “01” it’ll become “01/" 
rather than waiting until after typing “100” to become “01/0”.

I’m not sure if the behavior is better. It’s harder to delete content.

You can play around with the code in StringDateFormatter…

HTH,
Harbs

> On Jan 22, 2019, at 9:16 PM, Carlos Rovira <[email protected]> wrote:
> 
> Ok,
> 
> what I get in Tour De Jewel and in my real app is the following error:
> 
> Uncaught TypeError: selectedDate.getMonth is not a function
>    at
> org.apache.royale.html.accessories.DateFormatMMDDYYYY.org.apache.royale.html.accessories.SimpleDateFormatter.format
> (SimpleDateFormatter.as:103)
>    at
> org.apache.royale.jewel.beads.controls.datefield.DateFieldMaskedTextInput.org_apache_royale_jewel_beads_controls_datefield_DateFieldMaskedTextInput_dateInputMask
> (DateFieldMaskedTextInput.as:172)
> org.apache.royale.html.accessories.SimpleDateFormatter.format @
> SimpleDateFormatter.as:103
> org.apache.royale.jewel.beads.controls.datefield.DateFieldMaskedTextInput.org_apache_royale_jewel_beads_controls_datefield_DateFieldMaskedTextInput_dateInputMask
> @ DateFieldMaskedTextInput.as:172
> 
> 
> You can take a look easily about this issue in Tour De Jewel in the Date
> Components section. Try to delete a date in the input filed and you'll see
> that error
> 
> 
> El mar., 22 ene. 2019 a las 20:04, Carlos Rovira (<[email protected]>)
> escribió:
> 
>> ok, so something is going wrong. I'm trying it in Tour De Jewel and that's
>> not happening
>> maybe there's some config to add? I'm testing in Google Chrome (maybe
>> could be a browser issue?)
>> 
>> thanks
>> 
>> El mar., 22 ene. 2019 a las 19:58, Harbs (<[email protected]>)
>> escribió:
>> 
>>> The slashes should be added automatically.
>>> 
>>>> On Jan 22, 2019, at 8:41 PM, Carlos Rovira <[email protected]>
>>> wrote:
>>>> 
>>>> Hi Harbs
>>>> 
>>>> thanks for working on this.
>>>> 
>>>> I just download you changes, build Core, Formatters, Jewel and Tour De
>>>> Jewel.
>>>> 
>>>> The first thing I notice is that typing in the DateField does not get
>>> the
>>>> slashes as it was done before. In fact if I don't write slashes, the
>>> date
>>>> is not valid. So the user must type the slash himself.
>>>> I think that's a regression from the state we had, where the component
>>>> write slashes for you.
>>>> 
>>>> I though the fixes should try to fix the deletion of characters that was
>>>> having trouble with slashes, not remove the adding of slashes at all.
>>>> 
>>>> I'm going now to test in our real app to see how it behaves.
>>>> 
>>>> Thanks
>>>> 
>>>> 
>>>> 
>>>> 
>>>> El mar., 22 ene. 2019 a las 18:12, Harbs (<[email protected]>)
>>> escribió:
>>>> 
>>>>> Carlos,
>>>>> 
>>>>> Please check out what I did. I think the Date validation works better
>>> now.
>>>>> 
>>>>> I added a StringDateFormatter which I think does the job…
>>>>> 
>>>>>> On Jan 22, 2019, at 7:10 PM, [email protected] wrote:
>>>>>> 
>>>>>> This is an automated email from the ASF dual-hosted git repository.
>>>>>> 
>>>>>> harbs pushed a change to branch develop
>>>>>> in repository https://gitbox.apache.org/repos/asf/royale-asjs.git.
>>>>>> 
>>>>>> 
>>>>>>  from 6783bde  try to clean dumps out of nightly
>>>>>>   new 407d99e  Simplified formatters
>>>>>>   new 4fabdc7  Formatters appear to work
>>>>>>   new 3545a3f  Merge branch 'feature/redo-formatters' into develop
>>>>>> 
>>>>>> The 8538 revisions listed above as "new" are entirely new to this
>>>>>> repository and will be described in separate emails.  The revisions
>>>>>> listed as "add" were already present in the repository and have only
>>>>>> been added to this reference.
>>>>>> 
>>>>>> 
>>>>>> Summary of changes:
>>>>>> .../src/main/royale/DateComponentsPlayGround.mxml  |   2 +-
>>>>>> .../JewelJS/src/main/config/compile-js-config.xml  |   1 +
>>>>>> .../projects/Basic/src/main/resources/defaults.css |   2 +-
>>>>>> .../royale/org/apache/royale/html/DateField.as     |   4 +-
>>>>>> .../org/apache/royale/html/beads/DateFieldView.as  |  12 +-
>>>>>> .../projects/Core/src/main/royale/CoreClasses.as   |   2 +-
>>>>>> .../royale/org/apache/royale/core/IFormatBead.as   |  69 ----------
>>>>>> ...IDataGridPresentationModel.as => IFormatter.as} |  20 +--
>>>>>> .../projects/Flat/src/main/resources/defaults.css  |   2 +-
>>>>>> .../src/main/resources/basic-manifest.xml          |   6 +-
>>>>>> .../royale/org/apache/royale/core/FormatBase.as    |  69 +---------
>>>>>> .../royale/html/accessories/CurrencyFormatter.as   | 125
>>>>> +----------------
>>>>>> .../html/accessories/DateAndTimeFormatter.as       |  95 ++-----------
>>>>>> .../royale/html/accessories/DateFormatDDMMYYYY.as  |   2 +-
>>>>>> .../royale/html/accessories/DateFormatMMDDYYYY.as  |   2 +-
>>>>>> .../royale/html/accessories/DateFormatYYYYMMDD.as  |   2 +-
>>>>>> .../royale/html/accessories/NumberFormatter.as     | 114
>>> +---------------
>>>>>> .../royale/html/accessories/SimpleDateFormatter.as | 152
>>>>> +++++----------------
>>>>>> .../royale/html/accessories/StringDateFormatter.as | 119
>>> ++++++++++++++++
>>>>>> .../royale/html/beads/FormatableLabelView.as       |  20 ++-
>>>>>> .../royale/html/beads/FormatableTextInputView.as   |  23 +---
>>>>>> frameworks/projects/Jewel/pom.xml                  |  14 ++
>>>>>> .../Jewel/src/main/config/compile-swf-config.xml   |   1 +
>>>>>> .../projects/Jewel/src/main/resources/defaults.css |   2 +-
>>>>>> .../royale/org/apache/royale/jewel/DateField.as    |   4 +-
>>>>>> .../controls/datefield/DateFieldMaskedTextInput.as |  39 ++----
>>>>>> .../royale/jewel/beads/views/DateFieldView.as      |  31 +++--
>>>>>> .../Jewel/src/main/sass/components/_datefield.sass |   2 +-
>>>>>> .../staticControls/accessories/NumberFormatter.as  | 116
>>> +---------------
>>>>>> .../accessories/PhoneNumberFormatter.as            | 117
>>> +---------------
>>>>>> 30 files changed, 278 insertions(+), 891 deletions(-)
>>>>>> delete mode 100644
>>>>> 
>>> frameworks/projects/Core/src/main/royale/org/apache/royale/core/IFormatBead.as
>>>>>> copy
>>>>> 
>>> frameworks/projects/Core/src/main/royale/org/apache/royale/core/{IDataGridPresentationModel.as
>>>>> => IFormatter.as} (77%)
>>>>>> create mode 100644
>>>>> 
>>> frameworks/projects/Formatters/src/main/royale/org/apache/royale/html/accessories/StringDateFormatter.as
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> --
>>>> Carlos Rovira
>>>> http://about.me/carlosrovira
>>> 
>>> 
>> 
>> --
>> Carlos Rovira
>> http://about.me/carlosrovira
>> 
>> 
> 
> -- 
> Carlos Rovira
> http://about.me/carlosrovira

Reply via email to