From cd9d128b47ed523036f7ae1232ec7adcf04ed8a9 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Tue, 9 Jun 2020 18:23:43 +0200 Subject: [PATCH] Workaround intl bug by harding 'en' locale https://github.com/dart-lang/intl/issues/266 This is strange since Intl.getLocale() returns 'en_US' in my case. Currently, GitJournal only supports 'english' anyway, so this shouldn't be a big problem. --- lib/folder_views/journal_view.dart | 4 ++-- lib/folder_views/standard_view.dart | 2 +- lib/setup/repo_selector.dart | 2 +- lib/utils/datetime.dart | 4 ++-- lib/widgets/journal_editor_header.dart | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/folder_views/journal_view.dart b/lib/folder_views/journal_view.dart index 8de651bb..b978573e 100644 --- a/lib/folder_views/journal_view.dart +++ b/lib/folder_views/journal_view.dart @@ -13,8 +13,8 @@ class JournalView extends StatelessWidget { final NotesFolder folder; final String emptyText; - static final _dateFormat = DateFormat('dd MMM, yyyy '); - static final _timeFormat = DateFormat('Hm'); + static final _dateFormat = DateFormat('dd MMM, yyyy ', 'en'); + static final _timeFormat = DateFormat('Hm', 'en'); JournalView({ @required this.folder, diff --git a/lib/folder_views/standard_view.dart b/lib/folder_views/standard_view.dart index 1ec57923..d39c3a68 100644 --- a/lib/folder_views/standard_view.dart +++ b/lib/folder_views/standard_view.dart @@ -22,7 +22,7 @@ class StandardView extends StatelessWidget { final StandardViewHeader headerType; final bool showSummary; - static final _dateFormat = DateFormat('dd MMM, yyyy'); + static final _dateFormat = DateFormat('dd MMM, yyyy', 'en'); StandardView({ @required this.folder, diff --git a/lib/setup/repo_selector.dart b/lib/setup/repo_selector.dart index 0817c3ed..4c952bf3 100644 --- a/lib/setup/repo_selector.dart +++ b/lib/setup/repo_selector.dart @@ -189,7 +189,7 @@ class GitHostSetupRepoSelectorState extends State { } Widget _buildRepoTile(GitHostRepo repo) { - final _dateFormat = DateFormat('dd MMM, yyyy'); + final _dateFormat = DateFormat('dd MMM, yyyy', 'en'); Widget trailing = Container(); if (repo.updatedAt != null) { diff --git a/lib/utils/datetime.dart b/lib/utils/datetime.dart index b30d3ceb..6d6283df 100644 --- a/lib/utils/datetime.dart +++ b/lib/utils/datetime.dart @@ -2,8 +2,8 @@ import 'dart:core'; import 'package:gitjournal/utils/logger.dart'; import 'package:intl/intl.dart'; -final _simpleDateFormat = DateFormat("yyyy-MM-dd-HH-mm-ss"); -final _iso8601DateFormat = DateFormat("yyyy-MM-ddTHH:mm:ss"); +final _simpleDateFormat = DateFormat("yyyy-MM-dd-HH-mm-ss", 'en'); +final _iso8601DateFormat = DateFormat("yyyy-MM-ddTHH:mm:ss", 'en'); String toSimpleDateTime(DateTime dt) { return _simpleDateFormat.format(dt); diff --git a/lib/widgets/journal_editor_header.dart b/lib/widgets/journal_editor_header.dart index 9db8299d..f8ac821e 100644 --- a/lib/widgets/journal_editor_header.dart +++ b/lib/widgets/journal_editor_header.dart @@ -12,8 +12,8 @@ class JournalEditorHeader extends StatelessWidget { if (note.created == null) { return Container(); } - var dateStr = DateFormat('MMMM, yyyy').format(note.created); - var timeStr = DateFormat('EEEE HH:mm').format(note.created); + var dateStr = DateFormat('MMMM, yyyy', 'en').format(note.created); + var timeStr = DateFormat('EEEE HH:mm', 'en').format(note.created); var bigNum = Text( note.created.day.toString(),