diff --git a/Gemfile b/Gemfile index 94b28e5..dc53331 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ group :development, :test do gem 'spring' gem 'spring-commands-rspec' gem 'semantic-ui-sass' + gem 'foundation-rails', '~> 5.4' gem "select2-rails" #gem 'carrierwave' #gem 'fog-aws' diff --git a/lib/core_extensions/time/epoch_week.rb b/lib/core_extensions/time/epoch_week.rb index 8fa2b16..27e92bd 100644 --- a/lib/core_extensions/time/epoch_week.rb +++ b/lib/core_extensions/time/epoch_week.rb @@ -1,7 +1,8 @@ module CoreExtensions module Time module EpochWeek - EPOCH_BASE = -262800 # ::Time.at(0).utc.beginning_of_week # MONDAY!!!!! + #EPOCH_BASE = -262800 # ::Time.at(0).utc.beginning_of_week # MONDAY!!!!! + EPOCH_BASE = 259200 # -1*::Time.at(0).utc.beginning_of_week.to_i # MONDAY!!!!! '1969-12-29T00:00:00Z'.to_time.to_i + Time::EPOCH_BASE should be zero def epoch_week ((to_i + EPOCH_BASE) / 604800).floor end diff --git a/spec/dummy/app/assets/javascripts/application.js.coffee b/spec/dummy/app/assets/javascripts/application.js.coffee index 10d76e9..9866b00 100644 --- a/spec/dummy/app/assets/javascripts/application.js.coffee +++ b/spec/dummy/app/assets/javascripts/application.js.coffee @@ -2,8 +2,9 @@ #= require jquery_ujs #= require dunlop #= require_directory . -# require foundation -# require select2 +# test app is still foundation, until enough love from somebody to convert (or phase out foundation) +#= require foundation +#= require select2 $ -> $(document).foundation() $(document).find('select.smart-select').select2() diff --git a/spec/lib/core_extensions/time/epoch_week_spec.rb b/spec/lib/core_extensions/time/epoch_week_spec.rb index 7a7d713..ccc748e 100644 --- a/spec/lib/core_extensions/time/epoch_week_spec.rb +++ b/spec/lib/core_extensions/time/epoch_week_spec.rb @@ -1,6 +1,10 @@ require 'rails_helper' RSpec.describe Time do #epoch_week + it "has a proper bias for making the monday of the epoch time the base unit" do + ('1969-12-29T00:00:00Z'.to_time.to_i + Time::EPOCH_BASE).should be_zero + end + expectations = { '2017-01-01' => 2452, # year 2016, week 52 '2020-12-24' => 2660, # year 2020, week 52 @@ -12,7 +16,7 @@ RSpec.describe Time do #epoch_week } expectations.each do |time, expected_epoch_week| it "has the proper epoch_week for #{time}" do - time.to_time.epoch_week.should eq expected_epoch_week + "#{time}T00:00:00Z".to_time.epoch_week.should eq expected_epoch_week end end end