All Projects → rashidlaasri → Travel

rashidlaasri / Travel

Licence: mit
Framework agnostic PHP package to control the time.

Projects that are alternatives of or similar to Travel

Carbon
A simple, semantic and developer-friendly golang package for datetime
Stars: ✭ 565 (+125.1%)
Mutual labels:  time, date, carbon
Moment Range
Fancy date ranges for Moment.js
Stars: ✭ 1,639 (+552.99%)
Mutual labels:  time, date
Jiffy
Jiffy is a Flutter (Android, IOS and Web) date time package inspired by momentjs for parsing, manipulating, querying and formatting dates
Stars: ✭ 238 (-5.18%)
Mutual labels:  time, date
Date Picker
📅 Custom responsive date picker widget for Android, written in Kotlin.
Stars: ✭ 146 (-41.83%)
Mutual labels:  time, date
Calendar
📅 PHP Date & Time library that solves common problems in object oriented, immutable way.
Stars: ✭ 113 (-54.98%)
Mutual labels:  time, date
Date Fns Timezone
Parsing and formatting date strings using IANA time zones for date-fns.
Stars: ✭ 118 (-52.99%)
Mutual labels:  time, date
Delorean
Delorean: Time Travel Made Easy
Stars: ✭ 1,793 (+614.34%)
Mutual labels:  time, date
Date And Time
A Minimalist DateTime utility for Node.js and the browser
Stars: ✭ 99 (-60.56%)
Mutual labels:  time, date
Time
Building a better date/time library for Swift
Stars: ✭ 1,983 (+690.04%)
Mutual labels:  time, date
Brpickerview
BRPickerView 封装的是iOS中常用的选择器组件,主要包括:日期选择器(支持年月日、年月等15种日期样式选择,支持设置星期、至今等)、地址选择器(支持省市区、省市、省三种地区选择)、自定义字符串选择器(支持单列、多列、二级联动、三级联动选择)。支持自定义主题样式,适配深色模式,支持将选择器组件添加到指定容器视图。
Stars: ✭ 2,149 (+756.18%)
Mutual labels:  time, date
Test Time
A helper to control the flow of time
Stars: ✭ 169 (-32.67%)
Mutual labels:  time, carbon
Sonataintlbundle
Symfony SonataIntlBundle
Stars: ✭ 212 (-15.54%)
Mutual labels:  time, date
Time Stamp
Get a formatted timestamp. Used in gulp, assemble, generate, and many others.
Stars: ✭ 104 (-58.57%)
Mutual labels:  time, date
Chrono
Date and time library for Rust
Stars: ✭ 1,780 (+609.16%)
Mutual labels:  time, date
Dateparse
GoLang Parse many date strings without knowing format in advance.
Stars: ✭ 1,365 (+443.82%)
Mutual labels:  time, date
Tail.datetime
A lightweight, translat- and configurable Open Source DateTime Picker, written in pure vanilla JavaScript!
Stars: ✭ 139 (-44.62%)
Mutual labels:  time, date
Dpicker
A framework-agnostic minimal date picker
Stars: ✭ 187 (-25.5%)
Mutual labels:  time, date
Tinytime
⏰ A straightforward date and time formatter in <1kb
Stars: ✭ 1,313 (+423.11%)
Mutual labels:  time, date
Luatz
Time, Date and Timezone library for lua
Stars: ✭ 92 (-63.35%)
Mutual labels:  time, date
Gostradamus
Gostradamus: Better DateTimes for Go 🕰️
Stars: ✭ 148 (-41.04%)
Mutual labels:  time, date

rashidlaasri travel

StyleCI License Travis Ci build Latest Version on Packagist Total Downloads

Travel is a framework agnostic wrapper around Carbon, it helps you travel to a certain date and travel back to today's date in a readable way.

Installation

You can install the package via composer:

composer require --dev rachidlaasri/travel

Usage

Travel to a certain date with:

public function testBasicTest()
{
    Travel::to('01-01-2009');

    // Date is now 01-01-2009
    // code goes here...
}

Travel to a given date, excute a piece of code and reset:

public function testBasicTest()
{
    // Verify that the user cannot update a post after 10 minutes of its creation time.
    $post = factory(App\Post::class)->create();

    Travel::to('10 minutes', function() use ($post) {
        $this->postJson(route('posts.edit', $post->id), [])
            ->assertStatus(403);
    });
}

Travel to multiple dates with:

public function testBasicTest()
{
    // Travel to multiple dates:
    Travel::each(['01-01-2009', '04-02-2009', '03-02-2006'], function() {
        // Do something.
    });
}

Reset the date to today's date

Travel::back();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Treeware

You're free to use this package, but if it makes it to your production environment I would highly appreciate you buying the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees at offset.earth/treeware

Read more about Treeware at https://treeware.earth

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].