{"repo":"crystallabs/virtualtime","free":true,"listed":false,"github":"https://github.com/crystallabs/virtualtime","clone":"git clone https://github.com/crystallabs/virtualtime.git","description":"Advanced time, calendar, schedule, and remind library for Crystal","language":"Crystal","stars":23,"topics":["time","calendar","schedule","remind","crystal-lang","crystal"],"license":"AGPL-3.0","category":"productivity","readme_excerpt":"Installation Add the following to your application's \"shard.yml\": And run shards install or just shards . Introduction VirtualTime is a Time-related class for Crystal. It is used for matching and generation of compliant dates and times, primarily for calendar, scheduling, and reminding purposes. Crystal's struct Time has all its fields (year, month, day, hour, minute, second, nanosecond) set to a specific numeric value. Even if some of its fields aren't required in the constructor, internally they still get initialized to 0, 1, or other suitable value. As such, Time instances always represent specific dates and times (\"materialized\" dates and times in VirtualTime's terminology). On the other hand, VirtualTime s do not have to represent any specific points in time (although they can be defined precisely enough (or converted) so that they do). They are intended for conveniently matching broader sets of values and for finding/generating times that match certain constraints. 1. Matching Times You can express date and time constraints in the VirtualTime object and then match various Time s against it to determine which ones match. For example, let's create a VirtualTime that matches the last Saturday or Sunday of every month. This can be expressed using two constraints: - Day of month should be between -7 and -1 (the last 7 days of any month) - Day of week should be 6 or 7 (Saturday or Sunday) Then we can check if the current Time matches it: 2. Matching VirtualTimes In addition t","default_branch":null,"files":null,"tree":[],"storefront":"/r/crystallabs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/crystallabs/virtualtime/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}