-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
toDate() and time in future - relative time is wrong #3605
Comments
Confirmed. Test code: <?php
require_once("class2.php");
require_once(HEADERF);
$timestamp = "1577880000"; // January 1st, 2020. 12:00 (24h)
$text = "Long: ".e107::getParser()->toDate($timestamp, "long")." <br >";
$text .= "Relative: ".e107::getParser()->toDate($timestamp, "relative")." <br >";
$ns->tablerender($caption, $text);
require_once(FOOTERF); |
So it works properly when I install the plugin "Livetime" by @arunshekher which includes the actual JS files required to make use of the 'livestamp' plugin (http://mattbradley.github.io/livestampjs/) referred to in the docs of the By default these files are not included. I'm just wondering why by default it does support "x time ago" but not future. Researching.... |
And I think there is hardcoded Lang string as AGO. (translated but always ago) |
When using 'relative', by default the This by default returns
I think it should also consider datestamps in the future. |
@Moc I agree. 👍 |
@CaMer0n Can you check if my fix is OK please? I am pretty sure it could be done more efficiently but I didn't want to break anything as it such a core method. |
@Moc I ran the test and it failed. It appears to be placing 'in ' in all cases for me. How about you? |
@Moc I found some time to rewrite it. Please give it a try. Thanks. |
@CaMer0n Thanks! Just tested and it seems to work fine 👍 |
Used in relative datestamp. This makes sure "just now" is properly displayed".
I have those data:
Result:
Date is correctly saved in Unix forum. Manual checking:
What could be wrong?
Server time is correct (user timezone is not used)
Checked html code:
<span data-livestamp="1546988400">1 day ago</span>
The text was updated successfully, but these errors were encountered: