Merge branch 'intl-fix-dependencies' into 'master'
[Intl] Remove dependency See merge request famedly/famedlysdk!94
This commit is contained in:
commit
97d3f1ece3
|
@ -21,10 +21,6 @@
|
||||||
* along with famedlysdk. If not, see <http://www.gnu.org/licenses/>.
|
* along with famedlysdk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: localize this!
|
|
||||||
|
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
|
|
||||||
/// Used to localize and present time in a chat application manner.
|
/// Used to localize and present time in a chat application manner.
|
||||||
class ChatTime {
|
class ChatTime {
|
||||||
DateTime dateTime = DateTime.now();
|
DateTime dateTime = DateTime.now();
|
||||||
|
@ -75,9 +71,9 @@ class ChatTime {
|
||||||
return "Sonntag";
|
return "Sonntag";
|
||||||
}
|
}
|
||||||
} else if (sameYear) {
|
} else if (sameYear) {
|
||||||
return DateFormat('dd.MM').format(dateTime);
|
return "${_z(dateTime.day)}.${_z(dateTime.month)}";
|
||||||
}
|
}
|
||||||
return DateFormat('dd.MM.yyyy').format(dateTime);
|
return "${_z(dateTime.day)}.${_z(dateTime.month)}.${_z(dateTime.year)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the milliseconds since the Unix epoch.
|
/// Returns the milliseconds since the Unix epoch.
|
||||||
|
@ -122,7 +118,7 @@ class ChatTime {
|
||||||
|
|
||||||
/// Returns a simple time String.
|
/// Returns a simple time String.
|
||||||
String toTimeString() {
|
String toTimeString() {
|
||||||
return DateFormat('HH:mm').format(dateTime);
|
return "${_z(dateTime.hour)}.${_z(dateTime.minute)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If the ChatTime is today, this returns [toTimeString()], if not it also
|
/// If the ChatTime is today, this returns [toTimeString()], if not it also
|
||||||
|
@ -136,6 +132,8 @@ class ChatTime {
|
||||||
sameYear && now.month == dateTime.month && now.day == dateTime.day;
|
sameYear && now.month == dateTime.month && now.day == dateTime.day;
|
||||||
|
|
||||||
if (sameDay) return toTimeString();
|
if (sameDay) return toTimeString();
|
||||||
return "${toString()}, ${DateFormat('HH:mm').format(dateTime)}";
|
return "${toString()}, ${toTimeString()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String _z(int i) => i < 10 ? "0${i.toString()}" : i.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,13 +214,6 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.4"
|
version: "2.1.4"
|
||||||
intl:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: intl
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.16.0"
|
|
||||||
io:
|
io:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -13,7 +13,7 @@ dependencies:
|
||||||
|
|
||||||
http: ^0.12.0+2
|
http: ^0.12.0+2
|
||||||
mime_type: ^0.2.4
|
mime_type: ^0.2.4
|
||||||
intl: ^0.16.0
|
#intl: ^0.16.0
|
||||||
|
|
||||||
json_annotation: ^2.4.0
|
json_annotation: ^2.4.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue