Git Product home page Git Product logo

Comments (5)

hmdne avatar hmdne commented on June 2, 2024 1

I agree with you two @rubyFeedback and @AndyObtiva . I just noted the short-term partial solutions.

from opal.

hmdne avatar hmdne commented on June 2, 2024

Unfortunately, we won't be able to import date/datetime from Ruby, as it's implemented in C very much. What I may suggest would be to use Date.parse which is implemented.

Ref: #2569 which adds a bit of additional functionality

from opal.

rubyFeedback avatar rubyFeedback commented on June 2, 2024

What I may suggest would be to use Date.parse which is implemented.

One problem with this may be that it may not be extremely convenient to go the work-around route. Andy may
probably have to remember using Date.parse(), but even though I myself do not use DateTime#strptime, I think
it would simply be better to be able to stay "within" ruby as much as possible. One of opal's key promises is to just
write ruby and not have to worry about javascript much at all. I think the better long-term solution would be to
offer the same functionality whenever that is possible.

from opal.

AndyObtiva avatar AndyObtiva commented on June 2, 2024

@hmdne I was thinking you'd do what the JRuby folks do. Simply re-implement Date and DateTime in JavaScript or Opal Ruby code kinda like how they re-implement Ruby C features in Java or JRuby itself. There is no need to bring in the exact C code into Opal as long as you simulate it correctly in JavaScript or Opal Ruby code. It seems the PR that you linked to is doing some of that. Ideally, you would eventually implement the complete APIs of Date and DateTime.

That's very important to have in Opal in my opinion because Ruby Software Engineers are used to using Date and DateTime and I am sure those APIs are used by several Ruby gems, which would become portable in Opal once Date and DateTime are fully supported.

from opal.

janbiedermann avatar janbiedermann commented on June 2, 2024

@rubyFeedback regarding #2569, when working on it and looking into ruby source to get compatibility right, i noticed, that the current approach using regexps will never be sufficient, due to various conditions/special cases. Best approach seems to port c source to js for best compatibility. Needs some time.

from opal.

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.