Repository: jama5262/jiffy

Issue:
Add toString Support for Jiffy
**Is your feature request related to a problem? Please describe.**

This PR introduces a toString method to the Jiffy library, providing a standardized way to convert date-time objects into human-readable string representations. The format should follow ISO 8601 (YYYY-MM-DDTHH:MM:SSZ).





Fix patch:
diff --git a/lib/src/jiffy.dart b/lib/src/jiffy.dart
index 8f2ce8d..98d542d 100644
--- a/lib/src/jiffy.dart
+++ b/lib/src/jiffy.dart
@@ -943,4 +943,7 @@ class Jiffy {
 
   @override
   int get hashCode => dateTime.hashCode;
+
+  @override
+  String toString() => _dateTime.toIso8601String();
 }


Test patch:
diff --git a/test/src/jiffy_test.dart b/test/src/jiffy_test.dart
index 9eaeb08..4ae04dc 100644
--- a/test/src/jiffy_test.dart
+++ b/test/src/jiffy_test.dart
@@ -1080,7 +1080,7 @@ void main() {
     }
   });
 
-  group('Test equality and hashcode', () {
+  group('Test equality, hashcode and toString', () {
     for (var testData in equalityTestData()) {
       test("Should successfully test the equality of two Jiffy instances", () {
         // Setup
@@ -1115,6 +1115,15 @@ void main() {
       // Execute and Verify
       expect(jiffy1.hashCode, isNot(jiffy2.hashCode));
     });
+
+    test('Should successfully return the toString in ISO format', () {
+      // Setup
+      final jiffy = Jiffy.parseFromList([1997, 9, 23, 22, 5, 33, 123, 456]);
+      final expectedFormat = '1997-09-23T22:05:33.123456';
+
+      // Execute and Verify
+      expect(jiffy.toString(), equals(expectedFormat));
+    });
   });
 }