Hey everyone, I'm excited to share a new personal project I've been working on: a Dart package called "dated." If you've ever found yourself wrestling with DateTime objects, I think you'll find this helpful!
What Does "dated" Do?
Simply put, "dated" makes date and time calculations in Dart much more straightforward. It provides a set of convenient extensions for the DateTime class, making tasks like these a breeze:
- Comparing Dates: Easily check if two dates fall on the same day, month, or year.
- "Time Ago" Formatting: Get user-friendly strings like "2 hours ago" or "3 months ago" with minimal effort.
- Customization: Tailor the "time ago" output with prefixes and suffixes to match your app's style.
Why I Built It
While Dart's built-in DateTime functionality is solid, I often found myself writing repetitive code for common date-related operations. I created "dated" to streamline my own workflows and hopefully help others save time as well.
How to Use It
You can find "dated" on pub.dev: [Link to your package]. Once you add it to your project, you'll be able to do things like this:
DateTime eventTime = DateTime.now().subtract(const Duration(hours: 5));
String timeAgo = eventTime.timeAgo(); // Returns "5 hours ago"Check It Out!
GitHub: monzim/dated
PubDev: https://pub.dev/packages/dated
Detail Blog: dated-simplifying-datetime-operations-in-dart
I'm still actively developing "dated," and I'd love for you to give it a try. If you have any feedback, feature requests, or bug reports, please feel free to reach out. I'm eager to hear what you think and make "dated" even more useful.
Happy coding!

