Questions tagged [chronic]

Chronic is a natural language date/time parser written in pure Ruby.

Chronic is a natural language date/time parser written in pure Ruby.

It can parse a wide range of date and time formats including simple ones such as "today", "tomorrow", more complex ones such as "5 months before now", "3rd thursday this september" as well as specific dates and times such as "may 27th" and "January 5 at 7pm".

See chronic.rubyforge.org for more details.

32 questions
1
vote
1 answer

Is there a 24-hour time setting for Chronic?

I stumbled upon an interesting (and for quit some time puzzling) behavior using the Chronic gem. Parsing the string 1/21/13 2:20: Chronic.parse('1/21/13 2:20') => 2013-01-21 14:20:00 -0800 However, if a 0 is place in front of the…
Evan Zamir
  • 8,059
  • 14
  • 56
  • 83
0
votes
1 answer

Using Ruby Chronic To Calculate Offset Of Date

I use chronic to return parsed date objects like so: last_pay_date = Date.parse(Chronic.parse('2011-11-04').strftime("%Y-%m-%d")) two_weeks_ago = Date.parse(Chronic.parse("two weeks ago").strftime("%Y-%m-%d")) puts last_pay_date # 2011-11-04 puts…
johnnygoodman
  • 475
  • 6
  • 19
0
votes
1 answer

Using jQuery datepicker with Chronic

I'm trying to get a nice combination working for the strengths of the jQuery datepicker, and Chronic date parser for Ruby on Rails. The jQuery UI date picker is useful for selecting a date visually. But I would also like the user to be able to type…
asc99c
  • 3,815
  • 3
  • 31
  • 54
0
votes
0 answers

Chronic 404 errors on my Wordpress Blog and WooCommerce My Subscription Pages

I'm getting chronic 404 errors on my WooCommerce Subscription and blank page on my Wordpress Blog page. This problem gets fixed when I visit Permalink Settings in Wordpress admin dashboard and I don't even have to hit save. But after a while the…
0
votes
1 answer

Problems with RSpec and Chronic

I'm trying to use Chronic inside my non-rails project. When I try to get the specs with 'spec' I get the following error: $ spec spec/parsers/parser_english_spec.rb /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no…
Federico Builes
  • 4,939
  • 4
  • 34
  • 48
0
votes
2 answers

Chronic parsing Twitter dates to integer

Once again I am struggling with date formatting in Rails. I am trying to compare a date from ActiveRecord to the date a tweet was created in a cron rake but I am getting errors that I don not understand. "Wed Feb 02 23:04:18 +0000…
Phil Sturgeon
  • 30,637
  • 12
  • 78
  • 117
0
votes
0 answers

getting an argument out of range error for tickle

From the docs: https://github.com/yb66/tickle Tickle.parse('day') #=> {:next=>2010-05-10 20:57:36 -0400, :expression=>"day", :starting=>2010-05-09 20:57:36 -0400, :until=>nil} My console: 2.2.1 :013 > Tickle.parse('day') ArgumentError: argument…
Satchel
  • 16,414
  • 23
  • 106
  • 192
0
votes
1 answer

I need validate some tables for past dates, in the past 5 Saturdays from today using Chronic gem

I've installed the Chronic gem and while I can get Chronic.parse('Saturday', :context => :past) to return last Saturday's date but not '5 last saturdays' returns 'nil' I would like it to return in this format: strftime "%m%d%Y%H%M" I also can't…
0
votes
1 answer

Chronic stopped parsing a simple time format on a daylight savings day

I have been using Chronic successfully in my Rails app for a few weeks. I haven't been doing anything fancy with it, just using it to parse basic time inputs like '1:21pm' or '1440' etc. Everything was working fine up until today when I ran my test…
Benjamin Humphrey
  • 3,770
  • 2
  • 23
  • 41
0
votes
0 answers

How to parse variously formatted or natural language dates locally and pass to jquery datepicker?

I have a :date_as_text field in a Rails form. When the form is submitted this field is parsed by Chronic and a datetime saved to the database. As this is a text field, the user can type a variety of different date formats, or even 'today',…
Andy Harvey
  • 12,333
  • 17
  • 93
  • 185
0
votes
2 answers

Has Anyone Used Chronic or ChronicDuration in VoltRB?

I've put the chronic and chronic_duration gems in my Gemfile, and everything works fine in volt console. However, if I try anything on the client side, I get a name error. I tried requiring them in a client-side initializer, but that didn't…
Steve Ross
  • 4,134
  • 1
  • 28
  • 40
0
votes
1 answer

rails -- parse military time into AM/PM, using chronic?

I've been using Chronic, the natural language parser and its awesome. The problem I'm running into now is I cant parse the military time its give me back in to some form of AM/PM time that would be normal for a user to see. <%= Chronic.parse("next…
ChrisWesAllen
  • 4,935
  • 18
  • 58
  • 83
0
votes
1 answer

how do I enable recurring reminders for different users in ruby?

Currently, the users for my app set a specific date and time for a single reminder (using the Chronic gem). I have a cron job which runs every 10 minutes and checks if the time in the reminder is < Time.now at which point, it sends the reminder and…
Satchel
  • 16,414
  • 23
  • 106
  • 192
0
votes
1 answer

How to set timezone in ActiveSupport's TimeZone class

I am trying to parse text into a date using chronic in ruby. However, I keep running into an error while trying to parse the string. Error: NoMethodError - undefined method 'zone=' for Time:Class: Here is the code: require 'rubygems' require…
acenario
  • 117
  • 2
  • 10
0
votes
1 answer

Extract recognized date string passed to parse method in Chronic

I'd like to mimic the functionality of the Mac calendar quick event or Fantastical's quick entry. Using the Chronic gem, I can pass a string like: "Today at 3pm" => 2014-01-24 15:00:00 -0600 Chronic parsing doesn't work if you pass in something…
Steve
  • 592
  • 9
  • 24