diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ec39c1a..70a1d17 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -16,11 +16,13 @@ ## **Checklist** ### Code Changes + - [ ] I have added new features to the package (e.g., custom time thresholds, new languages, etc.) - [ ] I have fixed existing issues (e.g., incorrect formatting, performance bottlenecks) - [ ] I have improved the overall structure or optimized the codebase ### Documentation + - [ ] I have updated the README file or relevant documentation with the changes - [ ] I have added code usage examples or updated existing examples to reflect changes - [ ] I have updated the package version in the `pubspec.yaml` file @@ -28,27 +30,33 @@ ### Testing **General Tests** + - [ ] The package correctly formats time differences into human-readable strings - [ ] The package supports dynamic updates (e.g., changing locales, thresholds) **Localization** + - [ ] The package supports all documented languages - [ ] Custom locales can be added and work as expected - [ ] Language fallback works correctly if a specific locale is missing **Custom Thresholds** + - [ ] Custom time thresholds are applied correctly - [ ] The package handles edge cases like just now, future dates, or extreme past dates **Error Handling** + - [ ] The package handles null or invalid inputs gracefully - [ ] Fallback behavior works for unexpected or incorrect configurations **Responsiveness** + - [ ] The package adapts to time-zone differences accurately - [ ] The formatting responds correctly to locale changes in the app **Performance** + - [ ] The package performs efficiently, even when processing frequent or large updates - [ ] Performance tests show no regressions diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 46b5742..5b34434 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,9 +2,9 @@ name: Run Test Cases on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: check_up_to_date: @@ -41,7 +41,7 @@ jobs: uses: subosito/flutter-action@v2 with: channel: stable - flutter-version: 3.24.x + flutter-version: 3.27.x - name: Run Flutter doctor run: flutter doctor -v @@ -50,4 +50,4 @@ jobs: run: flutter analyze - name: Run Flutter Tests - run: flutter test \ No newline at end of file + run: flutter test diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index e78f061..ffe231d 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -2,7 +2,7 @@ name: Publish to GitHub Pages on: push: - branches: [ master ] + branches: [master] jobs: check_up_to_date: @@ -39,7 +39,7 @@ jobs: uses: subosito/flutter-action@v2 with: channel: stable - flutter-version: 3.24.x + flutter-version: 3.27.x - name: Check Flutter Version run: flutter --version @@ -54,4 +54,4 @@ jobs: uses: bluefireteam/flutter-gh-pages@v8 with: workingDir: example - baseHref: /get_time_ago/ \ No newline at end of file + baseHref: /get_time_ago/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 2efbb1a..2b597bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,252 +1,242 @@ # Changelog -## 2.1.1 +## [2.1.2] -- **Fix**: Demo web app issue fixed. -- **Security**: Added `SECURITY.md` for vulnerability reporting and security best practices. -- **Enhancement**: Added `Pull Request template` to ensure thorough checks for new contributions. +- **Updated:** Dependencies. -## 2.1.0 +## [2.1.1] -- **Change**: Added support for `Dutch` (nl) locale. -- **Change**: Dependencies updated. -- **Fix**: All known bugs and issues fixed. +- **Fixed:** Issue with the demo web app. +- **Security:** Added `SECURITY.md` for reporting vulnerabilities and ensuring security best practices. +- **Enhanced:** Added a pull request template for standardized contribution checks. -## 2.0.0 +## [2.1.0] -- **Breaking Change**: A new message method `justNow` added for displaying the time less than 15 seconds. -- **Documentation**: Updated the documentation to include breaking changes. -- **Improvement**: Added comments to the classes, messages, data, and utility functions. -- **Improvement**: New test cases are added and old test cases are removed or updated. +- **Added:** Support for Dutch (nl) locale. +- **Updated:** Dependencies. +- **Fixed:** All known bugs and issues. -## 1.3.1 +## [2.0.0] -- **Fix**: Lint errors and warnings fixed. +- **Breaking:** Introduced `justNow` method to display times less than 15 seconds. +- **Updated:** Documentation for breaking changes. +- **Improved:** Added comments to classes, messages, data, and utility functions. +- **Improved:** Updated and added new test cases. -## 1.3.0 +## [1.3.1] -- **Change**: Dependencies updated. -- **Documentation**: Updated the documentation to show all contributors. -- **Fix**: All known bugs and issues fixed. +- **Fixed:** Lint errors and warnings. -## 1.2.5 +## [1.3.0] -- **Change**: LICENSE changed to MIT. -- **Change**: Added support for `Romanian` (ro) locale. -- **Change**: Dependencies updated. -- **Fix**: All known bugs and issues fixed. +- **Updated:** Dependencies. +- **Updated:** Documentation to include all contributors. +- **Fixed:** All known bugs and issues. -## 1.2.4 +## [1.2.5] -- **Change**: Added support for `Persian` (fa) locale. -- **Fix**: All known bugs and issues fixed. +- **Changed:** License updated to MIT. +- **Added:** Support for Romanian (ro) locale. +- **Updated:** Dependencies. +- **Fixed:** All known bugs and issues. -## 1.2.3 +## [1.2.4] -- **Change**: `intl` version updated. -- **Change**: Removed unnecessary dependencies. -- **Fix**: All known bugs and issues fixed. +- **Added:** Support for Persian (fa) locale. +- **Fixed:** All known bugs and issues. -## 1.2.2 +## [1.2.3] -- **Change**: Removed unnecessary dependencies. -- **Fix**: All known bugs and issues fixed. +- **Updated:** `intl` package version. +- **Removed:** Unnecessary dependencies. +- **Fixed:** All known bugs and issues. -## 1.2.1 +## [1.2.2] -- **Documentation**: Updated documentation. -- **Fix**: All known bugs and issues fixed. +- **Removed:** Unnecessary dependencies. +- **Fixed:** All known bugs and issues. -## 1.2.0 +## [1.2.1] -- `intl` version updated. -- All known bugs fixed. +- **Updated:** Documentation. +- **Fixed:** All known bugs and issues. -## 1.1.8 +## [1.2.0] -- Added support for `Vietnamese` (vi) locale. -- All known issues have been fixed. +- **Updated:** `intl` package version. +- **Fixed:** All known bugs. -## 1.1.7 +## [1.1.8] -- Added Urdu (ur) and Arabic (ar) locales support. -- Added utility functions to convert English numbers to Urdu and Arabic numbers. -- Added and updated tests. -- Documentation improvements. -- All known bugs fixed. +- **Added:** Support for Vietnamese (vi) locale. +- **Fixed:** All known issues. -## 1.1.6 +## [1.1.7] -- Project structure changed/updated. -- Adding method to override DefaultMessages. -- Adding method to add your own Locale and Messages. -- Some unnecessary codes are removed. -- Documentation updated. +- **Added:** Urdu (ur) and Arabic (ar) locale support. +- **Added:** Utility functions to convert English numbers to Urdu and Arabic numbers. +- **Updated:** Tests and documentation. +- **Fixed:** All known bugs. -## 1.1.5 +## [1.1.6] -- Added Turkish (tr) locale support. -- Minor bug fixes. +- **Updated:** Project structure. +- **Added:** Method to override `DefaultMessages`. +- **Added:** Method to add custom locales and messages. +- **Removed:** Unnecessary code. +- **Updated:** Documentation. -## 1.1.4 +## [1.1.5] -- Minor bug fixes. -- Performance improvements. +- **Added:** Turkish (tr) locale support. +- **Fixed:** Minor bugs. -## 1.1.3 +## [1.1.4] -- Added Indonesian (id) locale support. -- Bug fixes. -- Documentation updated. +- **Fixed:** Minor bugs. +- **Improved:** Performance. -## 1.1.2 +## [1.1.3] -- Bug fixes. -- Documentation updated. +- **Added:** Indonesian (id) locale support. +- **Fixed:** Bugs. +- **Updated:** Documentation. -## 1.1.1 +## [1.1.2] -- Added Traditional Chinese (zh_tr) locale support. -- Bug fixes. -- Documentation updated. +- **Fixed:** Bugs. +- **Updated:** Documentation. -## 1.1.0 +## [1.1.1] -- Added German (de) locale support. -- Bug fixes. -- Documentation updated. +- **Added:** Traditional Chinese (zh_tr) locale support. +- **Fixed:** Bugs. +- **Updated:** Documentation. -## 1.0.9 +## [1.1.0] -- Added Korean (ko) locale support. -- Bug fixes. +- **Added:** German (de) locale support. +- **Fixed:** Bugs. +- **Updated:** Documentation. -## 1.0.8 +## [1.0.9] -- Bug fixes. -- Performance improvements. -- Source code optimization. +- **Added:** Korean (ko) locale support. +- **Fixed:** Bugs. -## 1.0.7+1 +## [1.0.8] -- Minor bug fixes. -- Performance improvements. +- **Fixed:** Bugs. +- **Improved:** Performance and source code optimization. -## 1.0.7 +## [1.0.7+1] -- Added Occitan (oc) locale support. -- Minor correction in French locale. -- Minor bug fixes. +- **Fixed:** Minor bugs. +- **Improved:** Performance. -## 1.0.6 +## [1.0.7] -- Added Japanese (ja) locale support. -- Added an argument that can change the DateFormat pattern. -- Documentation updated. -- Added updated screenshots from Android. -- Minor bug fixes. -- Performance improvements. +- **Added:** Occitan (oc) locale support. +- **Fixed:** Minor bugs and corrections in French locale. -## 1.0.5 +## [1.0.6] -- Documentation updated. +- **Added:** Japanese (ja) locale support. +- **Added:** Customizable `DateFormat` pattern argument. +- **Updated:** Documentation and screenshots for Android. +- **Fixed:** Minor bugs. +- **Improved:** Performance. -## 1.0.4 +## [1.0.5] -- Performance improvements. -- Time will display with date. +- **Updated:** Documentation. -## 1.0.3 +## [1.0.4] -- Name of default class changed to `GetTimeAgo`. -- Method `getTimeAgo` renamed to `parse`. -- Documentation updated. +- **Improved:** Performance. +- **Added:** Time display with date. -## 1.0.2 +## [1.0.3] -- Revamped documentation. -- Source code optimised. +- **Renamed:** Default class to `GetTimeAgo` and method `getTimeAgo` to `parse`. +- **Updated:** Documentation. -## 1.0.1 +## [1.0.2] -- Minor bug fixes. -- Added Simplified Chinese (zh) locale support. -- Source code optimised. -- Revamped documentation. +- **Optimized:** Source code. +- **Updated:** Documentation. -## 1.0.0 +## [1.0.1] -- Null Safety support. -- Minor bug fixes. -- Performance improvements. +- **Added:** Simplified Chinese (zh) locale support. +- **Fixed:** Minor bugs. +- **Optimized:** Source code. +- **Updated:** Documentation. -## 0.1.7 +## [1.0.0] -- Bug fixes. -- Performance improvements. +- **Added:** Null Safety support. +- **Fixed:** Minor bugs. +- **Improved:** Performance. -## 0.1.6 +## [0.1.7] -- Minor bug fixes. +- **Fixed:** Bugs. +- **Improved:** Performance. -## 0.1.3 +## [0.1.6] -- Minor bug fixes. -- Source code optimised. -- Revamped example for better illustration. +- **Fixed:** Minor bugs. -## 0.1.2 +## [0.1.3] -- Minor bug fixes. -- Revamped documentation. +- **Fixed:** Minor bugs. +- **Optimized:** Source code. +- **Updated:** Example for better illustration. -## 0.1.1 +## [0.1.2] -- Minor bug fixes. -- Revamped documentation. -- Revamped example for better illustration. +- **Fixed:** Minor bugs. +- **Updated:** Documentation. -## 0.1.0 +## [0.1.1] -- Added English (en) locale support. -- Added Spanish (es) locale support. -- Added French (fr) locale support. -- Added Hindi (hi) locale support. -- Added Portuguese (pt) locale support. -- Added Brazil (br) locale support. -- Source code optimised. -- Minor bug fixes. -- Revamped documentation. -- Revaped plugin to support for latest builds. -- Revamped example for better illustration. +- **Fixed:** Minor bugs. +- **Updated:** Documentation and examples. -## 0.0.7 +## [0.1.0] -- Minor bug fixes. +- **Added:** Support for English (en), Spanish (es), French (fr), Hindi (hi), Portuguese (pt), and Brazilian (br) locales. +- **Optimized:** Source code. +- **Fixed:** Minor bugs. +- **Updated:** Documentation and examples. -## 0.0.6 +## [0.0.7] -- Fixed some bugs. -- Updated example. +- **Fixed:** Minor bugs. -## 0.0.5 +## [0.0.6] -- Updated screenshots. +- **Fixed:** Bugs. +- **Updated:** Example. -## 0.0.4 +## [0.0.5] -- Added example for implementation. -- Added some android screenshots. -- Fixed some bugs. +- **Updated:** Screenshots. -## 0.0.3 +## [0.0.4] -- Made Function `getTimeAgo()` static. +- **Added:** Implementation example and Android screenshots. +- **Fixed:** Bugs. -## 0.0.2 +## [0.0.3] -- Use `TimeAgo.getTimeAgo` to format DateTime. +- **Made:** `getTimeAgo()` function static. -## 0.0.1 +## [0.0.2] + +- **Updated:** Functionality to use `TimeAgo.getTimeAgo` for formatting. + +## [0.0.1] - Initial release. diff --git a/README.md b/README.md index 00c4c03..146fa75 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,17 @@ A Dart package that converts and formats `DateTime` objects into human-readable 'time ago' strings, such as '20 seconds ago', 'a minute ago', or '7 hours ago'. This package provides an easy way to display relative time differences in your Flutter or Dart applications. It supports various time units (seconds, minutes, hours, days, etc.) and automatically adjusts the format based on how recent the event occurred. Ideal for displaying timestamps in news feeds, social media posts, or chat messages. [![pub package](https://img.shields.io/pub/v/get_time_ago.svg?label=Version&style=flat)][pub] -[![Stars](https://img.shields.io/github/stars/nixrajput/get-time-ago?label=Stars&style=flat)][repo] -[![Forks](https://img.shields.io/github/forks/nixrajput/get-time-ago?label=Forks&style=flat)][repo] -[![Watchers](https://img.shields.io/github/watchers/nixrajput/get-time-ago?label=Watchers&style=flat)][repo] -[![Contributors](https://img.shields.io/github/contributors/nixrajput/get-time-ago?label=Contributors&style=flat)][repo] -[![CI](https://github.com/nixrajput/get-time-ago/workflows/CI/badge.svg?style=flat)][pub] - -[![GitHub release (latest by date)](https://img.shields.io/github/v/release/nixrajput/get-time-ago?label=Latest&style=flat)][releases] -[![GitHub last commit](https://img.shields.io/github/last-commit/nixrajput/get-time-ago?label=Last+Commit&style=flat)][repo] -[![GitHub issues](https://img.shields.io/github/issues/nixrajput/get-time-ago?label=Issues&style=flat)][issues] -[![GitHub pull requests](https://img.shields.io/github/issues-pr/nixrajput/get-time-ago?label=Pull+Requests&style=flat)][pulls] -[![GitHub License](https://img.shields.io/github/license/nixrajput/get-time-ago?label=Licence&style=flat)][license] +[![Stars](https://img.shields.io/github/stars/nixrajput/get_time_ago?label=Stars&style=flat)][repo] +[![Forks](https://img.shields.io/github/forks/nixrajput/get_time_ago?label=Forks&style=flat)][repo] +[![Watchers](https://img.shields.io/github/watchers/nixrajput/get_time_ago?label=Watchers&style=flat)][repo] +[![Contributors](https://img.shields.io/github/contributors/nixrajput/get_time_ago?label=Contributors&style=flat)][repo] +[![CI](https://github.com/nixrajput/get_time_ago/workflows/CI/badge.svg?style=flat)][pub] + +[![GitHub release (latest by date)](https://img.shields.io/github/v/release/nixrajput/get_time_ago?label=Latest&style=flat)][releases] +[![GitHub last commit](https://img.shields.io/github/last-commit/nixrajput/get_time_ago?label=Last+Commit&style=flat)][repo] +[![GitHub issues](https://img.shields.io/github/issues/nixrajput/get_time_ago?label=Issues&style=flat)][issues] +[![GitHub pull requests](https://img.shields.io/github/issues-pr/nixrajput/get_time_ago?label=Pull+Requests&style=flat)][pulls] +[![GitHub License](https://img.shields.io/github/license/nixrajput/get_time_ago?label=Licence&style=flat)][license] ## Table of Contents @@ -263,8 +263,8 @@ Your support helps me dedicate more time to developing high-quality, impactful p [instagram]: https://instagram.com/nixrajput [linkedin]: https://linkedin.com/in/nixrajput [gmail]: mailto:nkr.nikhil.nkr@gmail.com -[releases]: https://github.com/nixrajput/get-time-ago/releases -[repo]: https://github.com/nixrajput/get-time-ago -[issues]: https://github.com/nixrajput/get-time-ago/issues -[license]: https://github.com/nixrajput/get-time-ago/blob/master/LICENSE -[pulls]: https://github.com/nixrajput/get-time-ago/pulls +[releases]: https://github.com/nixrajput/get_time_ago/releases +[repo]: https://github.com/nixrajput/get_time_ago +[issues]: https://github.com/nixrajput/get_time_ago/issues +[license]: https://github.com/nixrajput/get_time_ago/blob/master/LICENSE +[pulls]: https://github.com/nixrajput/get_time_ago/pulls diff --git a/SECURITY.md b/SECURITY.md index 9f7a3dc..1ce3d01 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -5,7 +5,7 @@ The following versions of the `get_time_ago` package are currently being supported with security updates: | Version | Supported | -|---------|--------------------| +| ------- | ------------------ | | 2.x.x | :white_check_mark: | | 1.3.x | :white_check_mark: | | 1.2.x | :x: | @@ -22,10 +22,10 @@ We take security issues seriously. If you discover any security vulnerabilities - **Email:** [`nkr.nikhil.nkr@gmail.com`, `nixlab.in@gmail.com`] - **Subject:** Security Issue in `get_time_ago` Package - **Information to include:** - - A description of the vulnerability - - Steps to reproduce (if applicable) - - The impact of the vulnerability - - Any potential fixes or patches + - A description of the vulnerability + - Steps to reproduce (if applicable) + - The impact of the vulnerability + - Any potential fixes or patches Please **do not** publicly disclose security vulnerabilities until we have confirmed and addressed them. We will work quickly to investigate and fix the issue. @@ -51,4 +51,4 @@ We commit to regularly reviewing and updating the package with necessary securit - Release a patch version immediately - Notify users through the release notes and the changelog -By adhering to these guidelines, you help ensure a more secure experience when using the `get_time_ago` package. \ No newline at end of file +By adhering to these guidelines, you help ensure a more secure experience when using the `get_time_ago` package. diff --git a/pubspec.yaml b/pubspec.yaml index 6eccf28..b705d82 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,21 +1,21 @@ name: get_time_ago description: A Dart package to convert and format `DateTime` objects into human-readable 'time ago' strings like '20 seconds ago', 'a minute ago', or '7 hours ago'. -version: 2.1.1 +version: 2.1.2 homepage: https://pub.dev/packages/get_time_ago -repository: https://github.com/nixrajput/get-time-ago -issue_tracker: https://github.com/nixrajput/get-time-ago/issues +repository: https://github.com/nixrajput/get_time_ago +issue_tracker: https://github.com/nixrajput/get_time_ago/issues environment: sdk: ">=2.18.0 <4.0.0" dependencies: - intl: ">=0.18.0 <0.20.0" + intl: ">=0.18.0 <0.21.0" dev_dependencies: - lints: ^5.0.0 - test: ^1.25.8 + lints: ^5.1.1 + test: ^1.25.14 topics: - get-time-ago diff --git a/test/test_message.dart b/test/custom_locale_test_message.dart similarity index 92% rename from test/test_message.dart rename to test/custom_locale_test_message.dart index fa525e8..9abe688 100644 --- a/test/test_message.dart +++ b/test/custom_locale_test_message.dart @@ -1,6 +1,6 @@ import 'package:get_time_ago/get_time_ago.dart'; -class TestMessages implements Messages { +class CustomLocaleTestMessages implements Messages { @override String prefixAgo() => ''; diff --git a/test/get_time_ago_test.dart b/test/get_time_ago_test.dart index bb5010f..21b0f53 100644 --- a/test/get_time_ago_test.dart +++ b/test/get_time_ago_test.dart @@ -2,7 +2,7 @@ import 'package:get_time_ago/get_time_ago.dart'; import 'package:intl/intl.dart'; import 'package:test/test.dart'; -import 'test_message.dart'; +import 'custom_locale_test_message.dart'; void main() { // Helper function to get the DateTime relative to now @@ -85,7 +85,7 @@ void main() { }); test('Test custom locale messages', () { - GetTimeAgo.setCustomLocaleMessages('test', TestMessages()); + GetTimeAgo.setCustomLocaleMessages('test', CustomLocaleTestMessages()); final dateTime = _getRelativeDateTime(const Duration(minutes: 3)); final result = GetTimeAgo.parse(dateTime, locale: 'test'); expect(result, equals('3 mins ago'));