Merge pull request #151 from krawieck/time-fix
This commit is contained in:
commit
e49cfa221f
|
@ -6,6 +6,7 @@
|
|||
|
||||
### Fixed
|
||||
|
||||
- Time of posts is now displayed properly. Unless you live in UTC zone, then you won't notice a difference.
|
||||
- Fixed a bug where links would not work on Android 11
|
||||
|
||||
## v0.2.3 - 2021-02-09
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import 'package:timeago/timeago.dart' as timeago;
|
||||
|
||||
extension FancyTime on DateTime {
|
||||
/// returns `this` time as a relative, human-readable string. In short format
|
||||
String get fancyShort => timeago.format(this, locale: 'en_short');
|
||||
|
||||
/// returns `this` time as a relative, human-readable string
|
||||
String get fancy => timeago.format(this);
|
||||
}
|
|
@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:lemmy_api_client/v2.dart';
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
import 'package:url_launcher/url_launcher.dart' as ul;
|
||||
|
||||
import '../comment_tree.dart';
|
||||
|
@ -13,6 +12,7 @@ import '../hooks/delayed_loading.dart';
|
|||
import '../hooks/logged_in_action.dart';
|
||||
import '../hooks/stores.dart';
|
||||
import '../util/extensions/api.dart';
|
||||
import '../util/extensions/datetime.dart';
|
||||
import '../util/goto.dart';
|
||||
import '../util/intl.dart';
|
||||
import '../util/text_color.dart';
|
||||
|
@ -385,7 +385,7 @@ class CommentWidget extends HookWidget {
|
|||
Text(compactNumber(comment.counts.score +
|
||||
(wasVoted ? 0 : myVote.value.value))),
|
||||
const Text(' · '),
|
||||
Text(timeago.format(comment.comment.published)),
|
||||
Text(comment.comment.published.fancy),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:lemmy_api_client/v2.dart';
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
import 'package:url_launcher/url_launcher.dart' as ul;
|
||||
|
||||
import '../hooks/delayed_loading.dart';
|
||||
|
@ -15,6 +14,7 @@ import '../pages/full_post.dart';
|
|||
import '../url_launcher.dart';
|
||||
import '../util/cleanup_url.dart';
|
||||
import '../util/extensions/api.dart';
|
||||
import '../util/extensions/datetime.dart';
|
||||
import '../util/goto.dart';
|
||||
import '../util/more_icon.dart';
|
||||
import 'bottom_modal.dart';
|
||||
|
@ -216,7 +216,7 @@ class PostWidget extends HookWidget {
|
|||
),
|
||||
TextSpan(
|
||||
text:
|
||||
' · ${timeago.format(post.post.published, locale: 'en_short')}'),
|
||||
' · ${post.post.published.fancyShort}'),
|
||||
if (post.post.locked)
|
||||
const TextSpan(text: ' · 🔒'),
|
||||
if (post.post.stickied)
|
||||
|
|
|
@ -3,12 +3,12 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:lemmy_api_client/v2.dart';
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
|
||||
import '../hooks/memo_future.dart';
|
||||
import '../hooks/stores.dart';
|
||||
import '../pages/manage_account.dart';
|
||||
import '../util/extensions/api.dart';
|
||||
import '../util/extensions/datetime.dart';
|
||||
import '../util/goto.dart';
|
||||
import '../util/intl.dart';
|
||||
import '../util/text_color.dart';
|
||||
|
@ -282,7 +282,7 @@ class _UserOverview extends HookWidget {
|
|||
),
|
||||
const SizedBox(height: 15),
|
||||
Text(
|
||||
'Joined ${timeago.format(userView.user.published)}',
|
||||
'Joined ${userView.user.published.fancy}',
|
||||
style: theme.textTheme.bodyText1,
|
||||
),
|
||||
Row(
|
||||
|
|
|
@ -267,7 +267,7 @@ packages:
|
|||
name: lemmy_api_client
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.10.2"
|
||||
version: "0.11.0"
|
||||
markdown:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -44,7 +44,8 @@ dependencies:
|
|||
# utils
|
||||
timeago: ^2.0.27
|
||||
fuzzy: <1.0.0
|
||||
lemmy_api_client: ^0.10.2
|
||||
lemmy_api_client: ^0.11.0
|
||||
|
||||
matrix4_transform: ^1.1.7
|
||||
|
||||
flutter:
|
||||
|
|
Loading…
Reference in New Issue