Results 1 to 5 of 5

Thread: Safari Date Parse

  1. #1

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Safari Date Parse

    I am using Kendo-UI's form component (documentation) and in the validate event I am:
    1. Grabbing a date value
    2. Parsing it to a Date by creating a new Date object
    3. Using Kendo.format (documentation) to strip out the time values


    Here is an example:
    Code:
    validate: function(e) {
        var parsedDate = kendo.format('{0: yyyy-MM-dd}', new Date(e.model.SubmittedDate));
        console.log(parsedDate);
    }
    This works in FireFox and Chrome, but in Safari it is returning NaN.

    My guess is that it is the Safari browser cannot properly parse the Date. Has anyone ran into this before? If so, what was a cross-browser solution?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Safari Date Parse

    HAve you validated that e.model.SubmittedDate contains a datetime to begin with in Safari? Just curious if maybe there's something else wrong there. Seems like it should work though. Can't think of a reason it wouldn't.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Safari Date Parse

    Yeah, I just verified with the client via a screen share.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Safari Date Parse

    Are you able to step into the .format function with the debugger in the browser? Nothing in that calling code would generate a not-a-number value, imo.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Safari Date Parse

    To be honest, I'm wondering if this is a caching issue. I made some changes a while back that implemented the code that I referenced in post #1 and I'm wondering if he just needs to do a hard refresh of his browser.

    I know for a fact that the value from e.model.SubmittedDate is in a valid date format because I printed it out in his console. But like an idiot, I didn't think to check the source tab to make sure the code was what I am expecting it to be.

    Unfortunately, I don't have a Mac to test this issue and I'm relying on screen shares with this guy and he's a C level executive. So anytime I have to do a screen share with him, I'm basically wasting his time.

    I sent him an email telling him to do a force refresh and to try it in a new private tab to see if it works. If it doesn't, I'm going to see if any of my local friends have a Mac I can debug this on.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width