Comments (5)
I agree with you two @rubyFeedback and @AndyObtiva . I just noted the short-term partial solutions.
from opal.
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.
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.
@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.
@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)
- Feature: Opalfile
- Bug: Methods defined by `Module#define_method` with UnboundMethod do not accept a block
- Bug: jsid_cache breaks for `"toString"`, and I suspect other methods of JS Object HOT 6
- is it possible to require 'openssl' in opalrb? HOT 1
- is it possible to require 'openssl' in opalrb? HOT 1
- Bug: `def` + `define_method` + `return` cause `LocalJumpError` HOT 1
- Feature: mirror Opal only classes into CRuby
- Bug: define_method -> block -> return -- unexpected return
- Bug: String#strip differs in handling the NBSP character
- 1.8.2 release was not completed HOT 2
- Bug: `Hash#compare_by_identity` does not work with string keys
- Bug: Bad behaviour with combination of: StringScanner#scan, multiline regexp, multiple lines HOT 2
- Bug: String interpolation with bridged classes does not call `to_s` HOT 2
- Bug: Cannot run minitest on Ruby 3.3 HOT 1
- Bug: `load` cannot be invoked on a path unless `require` has been called on it first
- Feature: `puts` & `p` can handle native JS objects not wrapped by `Native` for simple debugging/troubleshooting
- Rack, Roda, Sinatra and other framework compatibility (when running on Opal and Node or alternative)
- Feature: Interact with JS Object directly without having to manually wrap with Native HOT 1
- Bug: Segmentation fault when building with Opal::Builder#build_str HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opal.