Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing v1.0.0 #11

Merged
merged 69 commits into from Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
c13a7d4
Created develop branch
jama5262 Oct 12, 2019
c3ff604
[Started] Added the Intl dart package
jama5262 Oct 12, 2019
abc2da2
Added the get methods
jama5262 Oct 12, 2019
8681727
Setup the get datetime tests
jama5262 Oct 12, 2019
b3b0efb
Setup the manipulate methods
jama5262 Oct 12, 2019
b191ac7
Setup the display methods
jama5262 Oct 12, 2019
6f70330
[Finished] Added the query methods
jama5262 Oct 12, 2019
2e3a134
Merge pull request #2 from jama5262/setup-all-methods
jama5262 Oct 12, 2019
2fc4957
[Started] Started this branch
jama5262 Oct 12, 2019
4b2f67f
Setup the Jiffy datetime
jama5262 Oct 13, 2019
ca03305
[Finished] Set the Jiffy datetime instance tests
jama5262 Oct 13, 2019
cce3af1
[Finished] Minor changes
jama5262 Oct 13, 2019
4ac404a
Merge pull request #4 from jama5262/setup-jiffy-dateTime
jama5262 Oct 13, 2019
76272fa
[Started] Started this branch
jama5262 Oct 13, 2019
57e2ab4
Setup the Jiffy unix datetime
jama5262 Oct 13, 2019
f815b3f
[Finished] Setup Jiffy.unix tests
jama5262 Oct 13, 2019
7a45ca9
Merge pull request #5 from jama5262/setup-unix-parsing
jama5262 Oct 13, 2019
7cadb64
[Started] Started this branch
jama5262 Oct 13, 2019
52ace9d
Setup the add datetime method
jama5262 Oct 13, 2019
361c10e
Setup the subtract datetime method
jama5262 Oct 13, 2019
e2cb02b
Setup the startOf and endOf time
jama5262 Oct 13, 2019
d176748
Setup the utc and local datetime
jama5262 Oct 13, 2019
52a5f9f
[Finished] Added tests for manipulation
jama5262 Oct 13, 2019
157d2fc
[Finished] Minor fixes
jama5262 Oct 13, 2019
943c54a
[Finished] Minor fixes 2
jama5262 Oct 13, 2019
1bbbdb3
[Finished] Removed window testing on Travis
jama5262 Oct 13, 2019
d40ee66
Merge pull request #6 from jama5262/setup-manipulation
jama5262 Oct 13, 2019
4450216
[Started] Added the format method
jama5262 Oct 14, 2019
4357f48
Setup the format method
jama5262 Oct 14, 2019
5fe1764
Added the default datetime
jama5262 Oct 14, 2019
079ad60
Added valueOf and unix to get epoch milliseconds and seconds
jama5262 Oct 14, 2019
2670f25
Added the diff between two datetimes
jama5262 Oct 15, 2019
e4f3daa
Added setting localization
jama5262 Oct 15, 2019
2b27f64
Added the fromNow() and from() method to get relative time
jama5262 Oct 15, 2019
60abcb1
Finished with ar and pt locales
jama5262 Oct 16, 2019
f95ec43
[Finished] Jiffy display datetime done
jama5262 Oct 16, 2019
abfe2a1
[Finished] Fixed tests
jama5262 Oct 16, 2019
578a315
[Finished] Fixed tests 2
jama5262 Oct 16, 2019
5ea7492
[Finished] Fixed tests 3
jama5262 Oct 18, 2019
2200f47
[Finished] Fixed tests 5
jama5262 Oct 18, 2019
ef47bad
[Finished] Fixed tests 6
jama5262 Oct 18, 2019
85f3dd8
[Finished] Fixed tests 7
jama5262 Oct 18, 2019
e4e6a30
[Finished] Fixed tests 8
jama5262 Oct 18, 2019
58509f2
[Finished] Fixed tests 9
jama5262 Oct 18, 2019
6476234
[Finished] Fixed tests 10
jama5262 Oct 18, 2019
888d224
[Finished] Fixed tests 11
jama5262 Oct 18, 2019
6a72b1d
[Finished] Fixed tests 12
jama5262 Oct 18, 2019
8e9352f
[Finished] Fixed tests 13
jama5262 Oct 18, 2019
34a1faf
Merge pull request #7 from jama5262/setup-display
jama5262 Oct 18, 2019
6517bab
[Started] Added the isLeapYear method
jama5262 Oct 18, 2019
b3016cd
[Started] Added the isJiffy and isDatetime methods
jama5262 Oct 18, 2019
d4270d5
[Started] Added the isBefore methods
jama5262 Oct 18, 2019
06fbcfa
[Started] Added the isAfter methods
jama5262 Oct 18, 2019
85eef81
[Started] Added the isSame methods
jama5262 Oct 18, 2019
630bc85
Added the isSameOrAfter, isSameOrBefore and isBetween methods
jama5262 Oct 18, 2019
6c446bf
[Finished] Finished with jiffy query
jama5262 Oct 19, 2019
a820120
[Finished] Finished with jiffy query
jama5262 Oct 19, 2019
69175d6
Merge pull request #8 from jama5262/setup-query
jama5262 Oct 19, 2019
47867e3
Added example file
jama5262 Oct 19, 2019
d9510cd
Merge pull request #9 from jama5262/setup-example
jama5262 Oct 19, 2019
8e64965
[Started] Added the into doc
jama5262 Oct 20, 2019
11ce858
Set up the parse docs
jama5262 Oct 20, 2019
33c2912
Setup the get docs
jama5262 Oct 20, 2019
ac0814d
Setup the manipulation docs
jama5262 Oct 20, 2019
7d1e5ae
Setup the display docs
jama5262 Oct 20, 2019
a487d81
Setup the query docs
jama5262 Oct 20, 2019
f9866fb
Create LICENSE
jama5262 Oct 20, 2019
5dd3ec4
[Finished] Finished with docs
jama5262 Oct 20, 2019
2cb9a90
Merge pull request #10 from jama5262/setup-readme
jama5262 Oct 20, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
120 changes: 80 additions & 40 deletions .idea/libraries/Dart_Packages.xml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions .travis.yml
@@ -1,10 +1,20 @@
language: dart
dart:
- stable
os:
- linux
- osx
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libstdc++6
install:
- gem install coveralls-lcov
before_script:
- chmod +x ./tools/travis.sh
- git clone https://github.com/flutter/flutter.git
script: ./tools/travis.sh
after_success:
- coveralls-lcov coverage/lcov.info
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Jama Mohamed

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.
145 changes: 133 additions & 12 deletions README.md
@@ -1,22 +1,143 @@
A library for Dart developers.
# Jiffy

Created from templates made available by Stagehand under a BSD-style
[license](https://github.com/dart-lang/stagehand/blob/master/LICENSE).
[![Build Status](https://travis-ci.org/jama5262/jiffy.svg?branch=develop)](https://travis-ci.org/jama5262/jiffy)
[![Coverage Status](https://coveralls.io/repos/github/jama5262/jiffy/badge.svg?branch=develop)](https://coveralls.io/github/jama5262/jiffy?branch=develop)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Pub Version](https://img.shields.io/badge/pub-v1.0.0-blue)]()
[![Platform](https://img.shields.io/badge/platform-flutter%7Cweb%7Cdart%20vm-orange)](https://github.com/jama5262/jiffy)

## Usage
Jiffy is a dart date package inspired by [momentjs](https://momentjs.com/) for parsing, manipulating, querying and formatting dates

A simple usage example:
#### [Full Documentation](https://github.com/jama5262/jiffy/tree/setup-readme/docs) | [Installation]()

# Usage

## Format Dates
```dart
Jiffy().format("MMMM dd yyyy, h:mm:ss a"); // October 19 2019, 7:00:53 PM
Jiffy().format("EEEE"); // Saturday
Jiffy().format("yyyy 'escaped' yyyy"); // 2019 escaped 2019
Jiffy().format(); // 2019-10-19T19:00:53.090646

// You can also use default formats
Jiffy("19, Oct 2019", "dd, MMM yyyy").yMMMMd; // October 19, 2019
Jiffy().yMMMMEEEEdjm; // Saturday, October 19, 2019 7:00 PM
```

## Relative Time
```dart
Jiffy("2011-10-31", "yyyy-MM-dd").fromNow(); // 8 years ago
Jiffy("2012-06-20", "yyyy-MM-dd").fromNow(); // 7 years ago

var jiffy1 = Jiffy()
..startOf("day");
jiffy1.fromNow(); // 19 hours ago

var jiffy2 = Jiffy()
..endOf("day");
jiffy2.fromNow(); // in 5 hours

var jiffy3 = Jiffy()
..startOf("hour");
jiffy3.fromNow(); // 9 minutes ago
```

## Manipulation

```dart
import 'package:jiffy/jiffy.dart';
var jiffy1 = Jiffy()
..add(1, "day");
jiffy1.yMMMMd; // October 20, 2019

var jiffy2 = Jiffy()
..subtract(1, "day");
jiffy2.yMMMMd; // October 18, 2019

// You can chain methods by using Dart method cascading
var jiffy3 = Jiffy()
..add(1, "day")
..add(3, "hours")
..subtract(30, "minutes");
jiffy3.yMMMMEEEEdjm; // Sunday, October 20, 2019 9:50 PM

var jiffy4 = Jiffy()
..add(1, "day")
..add(3, "hours")
..subtract(30, "minutes");
jiffy4.format("dd/MM/yyy"); // 21/10/2019

main() {
var awesome = new Awesome();
}

// Months and year are added in respect to how many days there are in a months and if is a year is a leap year
Jiffy("2010-1-31", "yyyy-MM-dd"); // This is January 31
Jiffy("2010-1-31", "yyyy-MM-dd").add(1, "month"); // This is February 28
```

## Features and bugs
## Locale Support
```dart
// The locale method always return a future
// To get locale (The default locale is English)
await Jiffy.locale(); // en

// To set locale
await Jiffy.locale("fr");
Jiffy().yMMMMEEEEdjm; // samedi 19 octobre 2019 19:25

Please file feature requests and bugs at the [issue tracker][tracker].
await Jiffy.locale("ar");
Jiffy().yMMMMEEEEdjm; // السبت، ١٩ أكتوبر ٢٠١٩ ٧:٢٧ م

await Jiffy.locale("zh-cn");
Jiffy().yMMMMEEEEdjm; // 2019年10月19日星期六 下午7:28
```

[tracker]: http://example.com/issues/replaceme
## Contributing

To contribute, follow the following easy steps

### Step 1

- **Option 1**
- Fork this repo!

- **Option 2**
- 👯 Clone this repo to your local machine using `https://github.com/jama5262/jiffy.git`

### Step 2

- **HACK AWAY!** 🔨🔨🔨

### Step 3

- 🔃 Create a new pull request

## Support

Reach out to me at one of the following places!

- Email at jama3137@gmail.com
- Twitter [timedjama5262](https://twitter.com/timedjama5262)

## License

```
MIT License

Copyright (c) 2019 Jama Mohamed

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.
```