Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
42 views

Should updating rails and active record change the behavior of .days?

I updated rails from 5.2 to 5.2.8: gem 'railties', '~> 5.2.8.1 ' gem 'actionpack', '~> 5.2.8.1 ' gem 'actionmailer', '~> 5.2.8.1 ' gem 'activejob', '~> 5.2.8.1 ' gem 'activerecord', '~> ...
Davi Luis's user avatar
  • 426
0 votes
1 answer
50 views

Overlay time series data in Chartkick

With chartkick can I strip the date so only the time is left so the data can be overlaid on a 24 hour abscissa? <% the_date_time_span = the_date..the_date + 23.hour %> <% other_date_time_span ...
Greg's user avatar
  • 2,549
1 vote
2 answers
72 views

Query where Date.parse Rails

I'm using a calendar gem which requires event.start_time be recorded as "2023-11-07". I need to find all events in this month and last month based on the start_time, and in which event....
daveasdf_2's user avatar
0 votes
1 answer
47 views

processing a datetime + timezone inputs into UTC with rails

Ruby and rails have many methods to parse datetimes with timezone information, but lack an integrated mechanisms AFAIK to input both simultaneously, which is then compounded by the parsing ...
Jerome's user avatar
  • 6,023
1 vote
1 answer
25 views

Untangling multiple issues in handling timezones

An application is configured with a timezone that is not UTC. It also sets config.timezone = 'Bogota' config.active_record.default_timezone = :local` The motivation is to have system timestamps set-...
Jerome's user avatar
  • 6,023
1 vote
1 answer
65 views

parsing timestamptz to consider a timezone

A rails 7 application defines config.time_zone = 'Vienna' config.active_record.default_timezone = :local A model has two attributes date, :timestamptz # date is just short for actual column ...
Jerome's user avatar
  • 6,023
0 votes
3 answers
69 views

How to remove elements from array of dates between hours ranges Rails?

My array is generated by the start_date = (Date.today + 10.hours + 30.minutes).to_datetime end_date = (Date.today + 1.day + 18.hours).to_datetime period = 0.5/24 array = start_date....
Codrin's user avatar
  • 19
0 votes
1 answer
57 views

Ruby .past? method on date is giving wrong result in IST timezone for AWS server in India with UTC timezone

Im using the .past? method to check if the date is past date. Im using AWS EC2 servers and then are in India region. For the India time between 12 AM to 5.30 AM in the morning, If we convert IST ...
Akash Kinwad's user avatar
1 vote
2 answers
212 views

Ruby - Get the past x months from a giving date

How can I get the past x months from a giving date? so for instance, if the date is 2023-01-04, and I want the past 3 months (including the current date), it would give me an array of: [ '2023-01-01', ...
Rubioli's user avatar
  • 670
1 vote
1 answer
3k views

How to fix error TS2339: Property 'tz' does not exist on type 'Moment'?

In rails app, I created frontend app which uses angular. Here I am using moment and moment-timezone like "moment": "^2.22.2", "moment-timezone": "^0.5.23", In ...
Shruthi R's user avatar
  • 1,893
0 votes
1 answer
112 views

Ruby- date manipulation to fetch data

I have a requirement in ruby where I want to fetch all the data present in database for the current month. However, there is a catch. I wanted to fetch the data of current month based on plan start ...
sagar verma's user avatar
0 votes
3 answers
92 views

Rails "DateTime.tomorrow" to datetime

The title says it all and I'm just curious it this would be somehow possible. Can you parse the string "DateTime.tomorrow" to the DateTime object DateTime.tomorrow? Would that somehow be ...
marcHoll90's user avatar
0 votes
0 answers
106 views

Monkey Patch 'at_with_coercion' (activesupport) / Handle milliseconds from epoch

Description We have a Ruby and Rails application with a web frontend and an API to support web calls from outside the frontend. We use the API in one use case to create and update work orders (...
S.Mueller's user avatar
0 votes
1 answer
198 views

Convert datetime to time object in ruby on rails

I have a time like "estimatedTime": "2022-11-09T22:59:00Z" as json, which is parsed into datetime and saved in the db (t.datetime "estimated_time"). I want to find the ...
Priyanshu0007's user avatar
0 votes
2 answers
81 views

How to get the future nearest time in ruby

Suppose we have current time and then add the 60 munites to the current time. Time.now + 1.hours # => 2022-11-01 16:47:02.965861 +0500 after that we get the next half hour like 17:00:00 I'm able ...
Rq Bhatti's user avatar

15 30 50 per page
1
2 3 4 5
68