From fdc07ee94e04190137916ec67e0b4d547db50a99 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Thu, 17 May 2018 17:25:13 +0200 Subject: [PATCH] Show the actual date and time --- lib/main.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 7eade7e2..ae3c6c38 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,6 +3,8 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; +import 'package:intl/intl.dart'; + class Note { final DateTime createdAt; @@ -81,8 +83,11 @@ class JournalList extends StatelessWidget { } Widget _buildRow(BuildContext context, Note journal) { - var title = journal.createdAt.toString(); - var time = "10:24"; + var formatter = new DateFormat('dd MMM, yyyy'); + var title = formatter.format(journal.createdAt); + + var timeFormatter = new DateFormat('Hm'); + var time = timeFormatter.format(journal.createdAt); var body = journal.body; if (body.length >= 100) {