Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datetimes should be formatted as human-readable #8

Closed
matthewkogan opened this issue Dec 12, 2018 · 5 comments
Closed

Datetimes should be formatted as human-readable #8

matthewkogan opened this issue Dec 12, 2018 · 5 comments

Comments

@matthewkogan
Copy link

2018-12-12T11:14:16.653Z should appear as 12 December 2018, 11:14 or similar.

@IoApo
Copy link

IoApo commented Dec 12, 2018

hi there! This feature has to take into account the different timezones as well, as noone has the same time.
This could also help in conjuction/relation to the possibility for translating feeds [ #6 ] so the date format would be in a more human-readable way, and with localization as well (non mandatory though).

Timing with a reference to the timezone could help, especially if the feed provides correctly the date-time info.

@aureliendavid
Copy link
Owner

hi

I think the browser can do all this for us with stuff like toLocaleDateString in conjunction with navigator.language but I haven't had time to look into it properly

for now I just copy the dates as raw strings taken in the feed source which is sufficient for me

I'll try to do it soon

aureliendavid added a commit that referenced this issue Dec 14, 2018
@johnhawkinson
Copy link

Hi! FF63 refugee here. RSSPreview does a great job of restoring the functionality that just disappeared with an FF64 upgrade, but I tended to make significant use of the timing information in RSS feed previews and doing timezone math (whether in my head or by copy/pasting) is not a great experience.


Here's a comparison, using https://ecf.mad.uscourts.gov/cgi-bin/rss_outside.pl:

screen shot 2018-12-14 at 05 18 18

screen shot 2018-12-14 at 05 39 17


I think the browser can do all this for us with stuff like toLocaleDateString in conjunction with navigator.language but I haven't had time to look into it properly

Yes. You can get 90% of the way there without navigator.language:

>> (new Date).toLocaleString()
"12/14/2018, 6:02:07 AM"

And nearly there (And probably better!) with toLocaleDateString():

>> d=new Date
Date 2018-12-14T11:00:19.826Z
>> var options = {  year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric'};
undefined
>> d.toLocaleDateString(navigator.language, options)
"December 14, 2018, 6:00:19 AM"
>> var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric'};
undefined
>> d.toLocaleDateString(navigator.language, options)
"Friday, December 14, 2018, 6:00:19 AM"

But to make it look exactly as it did in FF63, with the " at " in the middle, you need to separately convert the date and time and concatenate them with [the localization of?] "at". It's a shame that Date.prototype.toLocaleFormat() is deprecated (the JS strftime() equivalent). But I think my preference would be to just use what's achievable with toLocaleDateString()

@aureliendavid
Copy link
Owner

aureliendavid commented Dec 14, 2018

I did it in the commit mentioned above (I think I like it better with the day-of-week and without the 'at').

I'll publish an update to AMO a bit later.

thanks for the feedback

@aureliendavid
Copy link
Owner

I've updated it on AMO (v2.2).

Reopen this issue if there are still problems on this subject.

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants