Making Dates Easy in Dart with the 'dated' Package cover image

Making Dates Easy in Dart with the 'dated' Package

I've created a new Dart package called 'dated' to make working with dates and times simpler. It provides handy tools for comparing dates, formatting 'time ago' strings, and customizing those strings to fit your project. Check it out on pub.dev and let me know what you think!

AZRAF AL MONZIM
flutter
dart
plugin

Project Overview

'dated' is currently available on pub.dev and I encourage you to give it a try. I believe it can streamline your date and time handling in Dart projects. If you have any feedback, feature requests, or bug reports, please don't hesitate to contact me. I'm always looking for ways to improve 'dated' and make it an even more valuable tool for the Dart community.

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!

Try it out