Skip to content

Commit

Permalink
Fixes date time parsing on non devices with locale different than EN US
Browse files Browse the repository at this point in the history
  • Loading branch information
juliano-souza000 authored Nov 3, 2024
1 parent dc821b8 commit ba70aa4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ String trimDoubleQuote(String str) {
}

DateTime parseRfc7231Time(String time) {
final format = DateFormat('EEE, dd MMM yyyy HH:mm:ss');
final format = DateFormat('EEE, dd MMM yyyy HH:mm:ss', 'en-US');
final isUtc = time.endsWith('GMT');
return format.parse(time, isUtc);
}

String toRfc7231Time(DateTime time) {
final format = DateFormat('EEE, dd MMM yyyy HH:mm:ss');
final format = DateFormat('EEE, dd MMM yyyy HH:mm:ss', 'en-US');
final result = format.format(time);
return time.isUtc ? '$result GMT' : result;
}
Expand Down

0 comments on commit ba70aa4

Please sign in to comment.