Giter Site home page Giter Site logo

Comments (4)

malclocke avatar malclocke commented on June 10, 2024

There's some relevant discussion here http://stackoverflow.com/questions/3085937/safari-js-cannot-parse-yyyy-mm-dd-date-format

from fulcrum.

cartuchogl avatar cartuchogl commented on June 10, 2024

I patch Date class with the link information and now jasmine test pass, and fulcrum is usable on Safari. I test this on MacOSX 10.6.8 with Safari 5.1 and Safari on IPad

The code:

// if can't parse dates with used format
if(typeof(new Date("2011-11-11"))!=Date) {
  // monkey patch it
  var orig = Date;
  Date = function() {
    if(arguments&&arguments.length>0) {
      if(arguments.length==1) {
        // can I apply the fix?
        if(arguments[0].replace) {
          return new orig(arguments[0].replace(/-/g,"/"));
        } else {
          // fallback
          return new orig(arguments[0]);
        }
      } else {
        // Date(year,month,day,hours,minutes,seconds,milliseconds) contructor
        var a = arguments;
        // how to do "new orig(unpack(args))" like lua?
        return new orig(
          a[0]?a[0]:null,a[1]?a[1]:null,a[2]?a[2]:null,a[3]?a[3]:null,
          a[4]?a[4]:null,a[5]?a[5]:null,a[6]?a[6]:null
        );
      }
    } else {
      return new orig();
    }
  }
}

I added this code on project.spec.js and 67 specs pass, and if I added this to fulcrum.js the app is now functional. I not sure what is the best place for that hack.

from fulcrum.

malclocke avatar malclocke commented on June 10, 2024

Thanks for that Carlos. I'd prefer a solution that doesn't require a different code path for different browsers. I've pushed a branch called experimental_fix_for_safari_date_parse, any Safari users able to try it?

from fulcrum.

malclocke avatar malclocke commented on June 10, 2024

Sorry, please ignore the request above. This should be fixed by Kale's code in #18

from fulcrum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.