Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
= eventual
== DESCRIPCIÓN:
Reconocimiento de fechas y periodos en lenguaje natural. Útil para crear interfaces de usuario basadas en texto.
== SINOPSIS:
El método event_parse del modulo Eventual reconoce y convierte una fecha o periodo expresado en lenguaje natural en objetos Date o DateTime
Ejemplos: require 'rubygems' require 'eventual'
Eventual.parse( 'del 5 al 7 de junio del 2009' ).map => [#<DateTime: 4909975/2,0,2299161>, #<DateTime: 4909977/2,0,2299161>, #<DateTime: 4909979/2,0,2299161>]
Eventual.parse( 'del 5 al 7 de junio' ).map{ |d| d.to_s } # Quizá mas tarde se localize a otros idiomas => ["2010-06-05", "2010-06-06", "2010-06-07"]
dates = Eventual.parse( 'del 5 al 7 de junio', :default_year => 2007 ) dates.map{ |d| d.to_s } => ["2007-06-05", "2007-06-06", "2007-06-07"]
Eventual.parse( 'del 5 al 7 de junio del 2009 a las 16:00 y 18:00 horas', :lang => :es ).map => [#<DateTime: 14729929/6,0,2299161>, #<DateTime: 9819953/4,0,2299161>, #<DateTime: 14729935/6,0,2299161>, #<DateTime: 9819957/4,0,2299161>, #<DateTime: 14729941/6,0,2299161>, #<DateTime: 9819961/4,0,2299161>]
Eventual.parse( 'del 5 al 7 de junio del 2009 a las 16:00 y 18:00 horas' ).map{ |d| d.to_s } => ["2009-06-05T16:00:00+00:00", "2009-06-05T18:00:00+00:00", "2009-06-06T16:00:00+00:00", "2009-06-06T18:00:00+00:00", "2009-06-07T16:00:00+00:00", "2009-06-07T18:00:00+00:00"]
Eventual.parse('lunes y martes de diciembre del 2001 a las 15:00').map{ |d| d.to_s }
=> ["2010-12-06T15:00:00+00:00", "2010-12-07T15:00:00+00:00", "2010-12-13T15:00:00+00:00", "2010-12-14T15:00:00+00:00", "2010-12-20T15:00:00+00:00", "2010-12-21T15:00:00+00:00", "2010-12-27T15:00:00+00:00", "2010-12-28T15:00:00+00:00"]
Eventual.parse( 'del 5 al 7 de junio del 2007' ).include? Date.civil(2007, 6, 6) => true
Eventual.parse( 'del 5 al 7 de junio del 2007' ).include? Date.civil(2006, 6, 6) => false
Eventual.parse( 'del 5 al 7 de junio del 2007 a las 16:00' ).include? DateTime.civil(2007, 6, 6, 16, 0) => true
Eventual.parse( 'del 5 al 7 de junio del 2007 a las 16:00' ).include? DateTime.civil(2007, 6, 6, 15, 0) => false
Eventual.parse( 'del 5 al 7 de junio del 2007 a las 16:00' ).include? Date.civil(2007, 6, 6) => true
Eventual.parse('1 de enero del 2010 de las 15:00 a las 16:00') => [(DateTime.civil 2010, 1, 1, 15)..(DateTime.civil 2010, 1, 1, 16)]
Eventual.parse('1 de enero del 2010 de las 15:00 a las 16:00 y de las 17:00 a las 19:00')
Ejemplos de formatos reconocidos:
== TODO:
Formatos a reconocer
== INSTALACIÓN:
[sudo] gem install eventual
== Documentation
http://rdoc.info/projects/maca/eventual
== LICENCIA:
(The MIT License)
Copyright (c) 2009 Macario Ortega
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Unknown package
We found that eventual demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.