0.0
No commit activity in last 3 years
No release in over 3 years
Takes an object and returns the equivalent UTC Time object
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.2
~> 0.9
= 2.10.0
 Project Readme

Tired of Dating?

Date UTC Parser was written so that I could guarantee to either get back a UTC Date Time object, or nil - while writing some API's for mobile apps. That's all I wanted, and that's what this guy does.

Along with that, it will return the humanized UTC example string, and it contains the regex that will match that string, can be used for error handling.

Using It

Install it as a gem

gem install date_utc_parser

Require it in your app

require 'date_utc_parser'

Start using it.

Some Examples

Time Object to UTC Time Object

unparsed_time = Time.now
unparsed_time.utc? #=> false 
parsed_time = DateUtcParser.parse unparsed_time # => 2012-07-07 18:59:02 UTC 
parsed_time.utc? #=> true 

UTC Time String to UTC Time Object

unparsed_time = "2012-07-08T12:13:14Z"
parsed_time = DateUtcParser.parse unparsed_time # => 2012-07-08 12:13:14 UTC
parsed_time.utc? #=> true 

Everything else

unparsed_time = "white russian"
parsed_time = DateUtcParser.parse unparsed_time # => nil

Contribute

Fork it, branch your topic, test it, make a pull request.

I suggest you bounce your idea off of me first so you don't make wasted effort.