Commit 8ca848dc authored by Leigh Stoller's avatar Leigh Stoller

Use moment.js for formatting dates.

parent c6e61644
require(window.APT_OPTIONS.configObject,
['js/quickvm_sup',
['js/quickvm_sup', 'moment',
'tablesorter', 'tablesorterwidgets'],
function (sup)
function (sup, moment)
{
'use strict';
......@@ -39,6 +39,14 @@ function (sup)
// Allows using filter_liveSearch or delayed search &
// pressing escape to cancel the search
$.tablesorter.filter.bindSearch( table, $('#experiment_search') );
// Format dates with moment before display.
$('.format-date').each(function() {
var date = $.trim($(this).html());
if (date != "") {
$(this).html(moment($(this).html()).format("ll"));
}
});
}
$(document).ready(initialize);
......
require(window.APT_OPTIONS.configObject,
['js/quickvm_sup',
['js/quickvm_sup', 'moment',
'tablesorter', 'tablesorterwidgets'],
function (sup)
function (sup, moment)
{
'use strict';
var ajaxurl = null;
......@@ -49,6 +49,13 @@ function (sup)
ShowTopology($(this).data("profile"));
});
// Format dates with moment before display.
$('.format-date').each(function() {
var date = $.trim($(this).html());
if (date != "") {
$(this).html(moment($(this).html()).format("ll"));
}
});
}
function ShowTopology(profile)
......
......@@ -104,7 +104,7 @@ while ($row = mysql_fetch_array($query_result)) {
$version = $row["profile_version"];
$uuid = $row["uuid"];
$status = $row["status"];
$created = $row["created"];
$created = DateStringGMT($row["created"]);
$creator_idx = $row["creator_idx"];
$profile_name = $profile_id;
$creator_uid = $row["creator"];
......@@ -122,7 +122,7 @@ while ($row = mysql_fetch_array($query_result)) {
echo "<td>$creator_uid</td>";
}
echo " <td>$status</td>
<td>$created</td>
<td class='format-date'>$created</td>
</tr>\n";
}
echo " </tbody>
......
......@@ -129,7 +129,7 @@ while ($row = mysql_fetch_array($query_result)) {
$name = $row["name"];
$pid = $row["pid"];
$desc = $row["description"];
$created = $row["created"];
$created = DateStringGMT($row["created"]);
$public = $row["public"];
$listed = ($row["listed"] ? "Yes" : "No");
$shared = $row["shared"];
......@@ -174,7 +174,7 @@ while ($row = mysql_fetch_array($query_result)) {
}
echo " <td style='white-space:nowrap'>$pid</td>
<td>$desc</td>
<td>$created</td>
<td class='format-date'>$created</td>
<td>$listed</td>
<td>$privacy</td>
</tr>\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment