Comments (3)
Sorry, I cannot reproduce your issue. I tried with both Ruby 2.4.9 and Ruby 2.6.6. Is there something else that might be causing your issue?
$ bin/console
>> RUBY_VERSION
=> "2.6.6"
>> BusinessTime::VERSION
=> "0.10.0"
>> Time.now.during_business_hours?
=> true
$ bin/console
>> RUBY_VERSION
=> "2.4.9"
>> BusinessTime::VERSION
=> "0.10.0"
>> Time.now.during_business_hours?
=> true
from business_time.
Closing this out until more information is provided.
from business_time.
@rmm5t I think I have a replication available along with the root cause, and I've replicated a test failure in our CI environment and my local machine.
RUBY_VERSION=2.7.4
Testing business time versions 0.9.3, 0.11.0
Test date: Sun, 14 Oct 2018 00:00:00 EDT -04:00
(although a Saturday would work as well)
In Ruby 2, sortedset
is part of the standard library, while in Ruby 3, sortedset was removed with a key difference.
In the gem, rbtree
is always required https://github.com/knu/sorted_set/blob/master/lib/sorted_set.rb#L7
In the original standard library implementation, rbtree
tries to load, but falls back to a normal hash if rbtree is unavailable (it's unavailable on my system if I try to run require "rbtree"
).
If a normal hash is used, the default value is false
https://github.com/ruby/ruby/blob/master/lib/set.rb#L246 but as far as I can tell, there's no such restriction in rbtree
. Below is an IRB console session that I captured on both 0.9.3 and 0.11.0
# 0.9.3
BusinessTime::Config.weekdays.instance_variable_get("@hash")
=> {1=>true, 2=>true, 3=>true, 4=>true, 5=>true}
BusinessTime::Config.weekdays.include?(0)
=> false
# 0.11.0
BusinessTime::Config.weekdays.instance_variable_get("@hash")
=> #<RBTree: {1=>true, 2=>true, 3=>true, 4=>true, 5=>true}, default=nil, cmp_proc=nil>
BusinessTime::Config.weekdays.include?(0)
=> nil
ETA: bug report on sorted_set available here: knu/sorted_set#2
Ah I see there was also a PR in this repo that was closed, apologies for the ping! #208
from business_time.
Related Issues (20)
- business_time_until doesn't account for holidays when called on Time objects HOT 1
- initiate business_time instead of global definitions HOT 3
- Short days before holiday HOT 1
- Still finding problems next business day for mondays HOT 3
- factory time vs. office time HOT 2
- Business day calculation wrong for weekends HOT 1
- Request for API for 'next business Friday' etc
- Wrong Result or unexpected not-business day ? HOT 1
- Business day calculations off when starting with a non-workday HOT 1
- business_days.after weird behaviour when not in workday and out of business hours. HOT 2
- Support Ruby 3.0.0 HOT 2
- No CHANGELOG for newer versions HOT 1
- [Bug] business_days.after inconsistencies HOT 3
- [Bug] Concurrency issues HOT 6
- rubocop-users: Rubocop-rails autocorrection mistake
- Support Time gem version >= 0.2.0 HOT 1
- Consider dropping external deps: sorted_set and rbtree dependencies? HOT 4
- The method from_now of Class: BusinessTime::BusinessDays returns different results under the same context HOT 6
- Allow business hours that cross midnight HOT 1
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 business_time.