timeago.dart icon indicating copy to clipboard operation
timeago.dart copied to clipboard

Clock variable is not working

Open Blacktoviche opened this issue 6 years ago • 5 comments

I'm trying to compare time to UTC by passing UTC date but it still take the time from mobile timezone Here is the test

DateTime utcDate = DateTime.now().toUtc(); DateTime serverDate = DateTime.parse(myEntity.publishDate); print("utc date: $utcDate"); print("server date: $serverDate"); print("app timezone date: ${DateTime.now()}"); print("format: ${timeago.format(serverDate, locale: "en",clock: utcDate)}");

and here is the result

utc date: 2019-11-11 15:47:07.547533Z server date: 2019-11-11 15:15:11.626 app timezone date: 2019-11-11 18:47:07.547691 format: 4 hours ago

Blacktoviche avatar Nov 11 '19 16:11 Blacktoviche

For me too, any solution for that ?

wxcvbn612 avatar Nov 23 '19 17:11 wxcvbn612

Nothing yet

Blacktoviche avatar Nov 30 '19 14:11 Blacktoviche

I know its an old issue but if you still care about this functionality, see comments of the PR here https://github.com/andresaraujo/timeago.dart/pull/142#issuecomment-859661123

andresaraujo avatar Jun 11 '21 15:06 andresaraujo

@andresaraujo Thank you so much. I may consider get back to this package in the future. because I'm using Jiffy which has "from" function Jiffy(DateTime.parse(serverDateTime)).from(mobileUTCDateTime)

and it works just fine for such a case.

Blacktoviche avatar Jun 15 '21 10:06 Blacktoviche

I know its an old issue but if you still care about this functionality, see comments of the PR here #142 (comment)

worked for me

arslankaleem7229 avatar Aug 01 '22 18:08 arslankaleem7229