LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  isDate not working as expected

    Employee
    Posted 04-24-2015 02:11

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: gmullin

    I came across this where isDate will return true for a date value of 2015-04-01z, when I do mydate.isDate("CCYY-MM-DD"). To me that should fail because of the z at the end. I've attached a couple of nodes I created to show this issue. If I change my check to also take into account the length of mydate, then I get the results I would have expected from isDate().

    Can anybody clarify if this is a problem with isDate() or my understanding of what it should do?


    node:Static_Data
    bretype:core::Static Data
    editor:sortkey=5538bcc41e0b3f34
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    mydate:string
    2015-04-01z
    2014-02-27abc
    b2014-02-27abc
    2014-02-27a
    2014-02-271234567895
    2014-02-27
    EOX
    editor:XY=170,150
    end:Static_Data
    
    node:Filter_26
    bretype:core::Filter
    editor:sortkey=5538bce5058171f4
    input:@40fd2c74167f1ca2/=Static_Data.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    
    
    emit *, (isDate(mydate, "CCYY-MM-DD")) as result, (isDate(mydate, "CCYY-MM-DD") and mydate.len() == 10) as result2
    
    EOX
    editor:XY=330,150
    end:Filter_26


  • 2.  RE: isDate not working as expected

    Employee
    Posted 04-25-2015 11:19

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ryeh

    As far as I can tell, the date/time functions work that way, i.e. only matching the characters that you specify. So because only 10 characters are being checked, the function will only check the first 10 characters. So while the result might not be intuitive at first, I do find the behavior consistent. For example, "2015-04-25 14:25:23".date("CCYY-MM-DD") will return 2015-04-25 as a date data type, even though there are a bunch of characters after the date.