Code Monkey home page Code Monkey logo

Comments (7)

joesnarky avatar joesnarky commented on August 15, 2024

Also you be nice to have time along with the date.

from tweet_ui.

kawa89 avatar kawa89 commented on August 15, 2024

Nice catch. Will try to fix it ASAP ;-)

from tweet_ui.

kawa89 avatar kawa89 commented on August 15, 2024

Fixed in version 1.1.0 :-) I also added time to the byline (for now only 24H format).

from tweet_ui.

joesnarky avatar joesnarky commented on August 15, 2024

I made this change for 12hr time since I needed it.

image

changed tweet_vm.dart

added a createdAtTime: _createdAtTime(tweet), to the tweetvm model

and the method
static String _createdAtTime(Tweet tweet) {
DateFormat twitterFormat = new DateFormat("EEE MMM dd HH:mm:ss '+0000' yyyy");
final dateTime = twitterFormat.parseUTC(tweet.createdAt).toLocal();

DateFormat displayFormatTime = new DateFormat("h:mm a");
return displayFormatTime.format(dateTime);

}

and for byline.dart added a row for the date with time

Row(
      mainAxisSize: MainAxisSize.max,
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: <Widget>[
        Expanded(
          child: Row(
            mainAxisSize: MainAxisSize.min,
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
			Text(
                  tweetVM.createdAt,
                  style: userScreenNameStyle,
                  textAlign: TextAlign.start,
                  softWrap: false,
                ),
			Text(
                " • " + tweetVM.createdAtTime,
                style: userScreenNameStyle,
                textAlign: TextAlign.start,
              )]))])
			
			
	]);

from tweet_ui.

kawa89 avatar kawa89 commented on August 15, 2024

Nice. Will try to add some configuration for this in the next release ;-)

from tweet_ui.

joesnarky avatar joesnarky commented on August 15, 2024

Oops I just realized even the Date displayed in your code is not correct for the users local timezone as well.

A tweet with created_at = "Sat Feb 22 04:39:00 +0000 2020" where my local timezone is -5h from this time. That means its 11:39PM on Sat Feb 21 my local time. Your code displays "Sat Feb 22"

Had to include the .toLocal() in your function to ensure the date is adjusted to my local date of the tweet. That way, when I click on the tweet and it jumps to twitter.com, the date matches with what twitter displays.

static String _createdAt(Tweet tweet) {
DateFormat twitterFormat = new DateFormat("EEE MMM dd HH:mm:ss '+0000' yyyy");
DateFormat displayFormat = new DateFormat("MM.dd.yyyy");
final dateTime = twitterFormat.parseUTC(tweet.createdAt).toLocal();
return displayFormat.format(dateTime);
}

from tweet_ui.

kawa89 avatar kawa89 commented on August 15, 2024

👍 Will check it this week with a PR that is pending from another user ;)

from tweet_ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.