date-formats library / gem - read / parse dates (and times) from around the world
Gerald Bauer <[email protected]> Mon, 11 Nov 2019 18:53:35 +0100
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <CAAxEZd-nzNZPft2WW4j-s5TXFC=b3=C9REpFYoPSyXvjN+pnrw@mail.gmail.com> |
Hello, I've put together a date-formats library / gem [1] that lets you read / parse date (and times) from around the world. Let's try a French date e.g. ``` DateFormats.parse( 'Lundi 1 Janvier', lang: 'fr') #=> <Date: 2019-01-01 ((2458485j,0s,0n),+0s,2299161j)> ``` or a Spanish date e.g. ``` DateFormats.parse( '1 Ene', lang: 'es' )` #=> <Date: 2019-01-01 ((2458485j,0s,0n),+0s,2299161j)> ``` and so on. Happy date wrangling with ruby. Cheers. Prost. PS: Yes, you can add new (and more) formats using regular expressions / text patterns. [1] https://github.com/sportdb/sport.db/tree/master/date-formats Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>