Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(date-time-utils): remove jiffy and use DateTime #17

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/src/utils/date_time_utils.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:intl/intl.dart';
import 'package:jiffy/jiffy.dart';

/// format 1 -> ' ' (space)
/// format 2 -> -
Expand Down Expand Up @@ -157,7 +156,7 @@ class DateTimeUtils {
}

static DateTime parseIsoDate(String startTime) {
return Jiffy.parse(startTime).dateTime;
return DateTime.parse(startTime).toLocal();
}

static DateTime getAbsoluteDate() {
Expand Down
8 changes: 0 additions & 8 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.4"
jiffy:
dependency: "direct main"
description:
name: jiffy
sha256: b09b6aacc0ebe7d178d2fcbabfd73e7d3340594043fe949bb7e0814093b00201
url: "https://pub.dev"
source: hosted
version: "6.3.0"
js:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ environment:
dependencies:
rxdart: ^0.27.7
intl: ^0.19.0
jiffy: ^6.3.0

# Logger
fa_dart_logger:
Expand Down
3 changes: 1 addition & 2 deletions test/utils/date_time_utils_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:fa_dart_core/src/utils/date_time_utils.dart';
import 'package:intl/intl.dart';
import 'package:jiffy/jiffy.dart';
import 'package:test/expect.dart';
import 'package:test/scaffolding.dart';

Expand Down Expand Up @@ -107,7 +106,7 @@ void main() {
});

test('should return DateTime from string date', () {
final expected = Jiffy.parse(dateTime.toIso8601String()).dateTime;
final expected = DateTime.parse(dateTime.toIso8601String());
final actual = DateTimeUtils.parseIsoDate(dateTime.toIso8601String());
expect(actual, expected);
});
Expand Down
Loading