Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rcdilorenzo/repeatex
Natural language for repeating dates
https://github.com/rcdilorenzo/repeatex
calendar elixir json-client live-demo natural-language parsing repeat
Last synced: 2 months ago
JSON representation
Natural language for repeating dates
- Host: GitHub
- URL: https://github.com/rcdilorenzo/repeatex
- Owner: rcdilorenzo
- License: mit
- Created: 2015-01-20T02:57:03.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-03-22T19:51:01.000Z (almost 6 years ago)
- Last Synced: 2024-08-02T02:11:34.403Z (5 months ago)
- Topics: calendar, elixir, json-client, live-demo, natural-language, parsing, repeat
- Language: Elixir
- Homepage: https://repeatex.rcdilorenzo.io
- Size: 86.9 KB
- Stars: 54
- Watchers: 3
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.eex.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Natural language parsing for repeating dates. (Date and Time)
- fucking-awesome-elixir - repeatex - Natural language parsing for repeating dates. (Date and Time)
- beamtoolbox - [ex
- awesome-elixir - repeatex - Natural language parsing for repeating dates. (Date and Time)
README
Repeatex
========![Test Status](https://travis-ci.org/rcdilorenzo/repeatex.svg)
![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)![Repeatex](logo.png)
Repeatex is a library for parsing, scheduling, and formatting repeating events. It handles many different expressions from "daily" to "on the 2nd tuesday and 4rd thursday of every other month". See [Usage](#usage) and [Examples](#examples) for more detail. It also can act as a validator / formatter for a JSON client which is described in the [Integration with Phoenix](#integration-with-phoenix) section.
# Usage
## Parsing
<%= parse.("mon-sat every week") %>
<%= parse.("mumbo jumbo") %>## Scheduling
<%= schedule.(Repeatex.parse("every other day"), today) %>
<%= schedule.(Repeatex.parse("mon and fri every other week"), today) %>
<%= schedule.(Repeatex.parse("on the 3rd tuesday of every month"), today) %>## Formatting
<%= format.(Repeatex.parse("on the 3rd tuesday of every month")) %>
<%= format.(Repeatex.parse("every week on monday")) %># Installation
As repeatex isn't finished yet, you'll need to specify this repository location to use in your projects:
```elixir
{:repeatex, github: "rcdilorenzo/repeatex"}
```# Integration with Phoenix
If you've got a phoenix application and you'd like to integrate repeatex for validation / formatting for a JSON client, simply add the following to your router:
```elixir
forward "/repeatex", Repeatex.Web
```See [test/controllers/README.md](test/controllers/README.md) for how to use the API.
# Contribution
If you would like to contribute to the parser of other parts of this project, please check out the [demo](http://rcdilorenzo.github.io/repeatex), and find other expressions that still need to be parsed, filing issues as needed. Even better, feel free to tackle any issues in the repository by submitting a friendly pull-request. Thanks!
# Examples
<%= examples %>
# TODO - Parsing
<%= pending %>
# Roadmap
- [x] Parsing natural language
- [x] Validate parsed structure
- [ ] Scheduler to determine next date - **Daily, Weekly, and Monthly are done**
- [x] Output natural description of repeat# License
Copyright (c) 2015-2016 Christian Di Lorenzo
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.