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

TTimeDelta for showing how long ago something was posted (eg 10 seconds, 39 minutes, 6 hours, etc) #777

Open
belisoful opened this issue May 18, 2021 · 6 comments

Comments

@belisoful
Copy link
Member

this is an interactive interface control for displaying how long ago something was done/posted/submitted/etc.

Many websites now have the "10 minutes ago" that updates in real time for how long ago something was posted.

PRADO needs a component for displaying how long ago something was done. I propose that clicking on the "xx minutes/hours ago" would change to the date and time of the event.

This is developed here:
https://github.com/belisoful/prado/blob/master/framework/Web/UI/WebControls/TTimeAgo.php

There is a javascript aspect to this component so Prado JS map is updated.

The major challenge is I18N of this component as the interface is driven by javascript rather than server side.

@belisoful
Copy link
Member Author

belisoful commented Jul 7, 2021

I'm thinking about how this should work. I have a prototype for comment here:

https://github.com/belisoful/prado/blob/master/framework/Web/UI/WebControls/TTimeAgo.php

I'm thinking of removing the "ago" part and just focus on the timing, both count down to a time, and how long ago a time was.

I'm also waiting on fixing my computer code so php ICU-units works. I'm just focusing on these other changes first.

@belisoful belisoful changed the title TTimeAgo for showing how long ago something was posted (eg 10 seconds ago, 39 minutes ago, 6 hours ago, etc) TTimeDelta for showing how long ago something was posted (eg 10 seconds, 39 minutes, 6 hours, etc) Jul 21, 2021
@belisoful
Copy link
Member Author

The environment I was in before didn't have the PHP resources built in for I18N. when I have a moment, I'll re-look at this again.

@belisoful
Copy link
Member Author

Maybe php 8 (and the OS) has these I8N resources on my dev system now

@ctrlaltca
Copy link
Member

You can use php's DateInterval to calculate the "time delta" and format it.
Then you can get localized data from ICU (php's intl extension).
A nice web interface to see what's available can be found here: https://intl.rmcreative.ru/unit-data/en
Prado\I18N\core\CultureInfo is already able to fetch data from ICU, but maybe you'll need to add support for the ICUDATA-unit table

@belisoful
Copy link
Member Author

I was trying to access the ICU Data but in the prior php system it was not found. It just wasn't there. So. It was delayed.

@belisoful
Copy link
Member Author

imagining: `"2023-05-31 13:11:11+800" web component? and having the TTimeAgo for the template?

Prado doesn't have any architecture for WebComponents. #963

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

No branches or pull requests

2 participants