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

Use moment.js for formatting dates.

parent c6e61644
require(window.APT_OPTIONS.configObject, require(window.APT_OPTIONS.configObject,
['js/quickvm_sup', ['js/quickvm_sup', 'moment',
'tablesorter', 'tablesorterwidgets'], 'tablesorter', 'tablesorterwidgets'],
function (sup) function (sup, moment)
{ {
'use strict'; 'use strict';
...@@ -39,6 +39,14 @@ function (sup) ...@@ -39,6 +39,14 @@ function (sup)
// Allows using filter_liveSearch or delayed search & // Allows using filter_liveSearch or delayed search &
// pressing escape to cancel the search // pressing escape to cancel the search
$.tablesorter.filter.bindSearch( table, $('#experiment_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); $(document).ready(initialize);
......
require(window.APT_OPTIONS.configObject, require(window.APT_OPTIONS.configObject,
['js/quickvm_sup', ['js/quickvm_sup', 'moment',
'tablesorter', 'tablesorterwidgets'], 'tablesorter', 'tablesorterwidgets'],
function (sup) function (sup, moment)
{ {
'use strict'; 'use strict';
var ajaxurl = null; var ajaxurl = null;
...@@ -49,6 +49,13 @@ function (sup) ...@@ -49,6 +49,13 @@ function (sup)
ShowTopology($(this).data("profile")); 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) function ShowTopology(profile)
......
...@@ -104,7 +104,7 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -104,7 +104,7 @@ while ($row = mysql_fetch_array($query_result)) {
$version = $row["profile_version"]; $version = $row["profile_version"];
$uuid = $row["uuid"]; $uuid = $row["uuid"];
$status = $row["status"]; $status = $row["status"];
$created = $row["created"]; $created = DateStringGMT($row["created"]);
$creator_idx = $row["creator_idx"]; $creator_idx = $row["creator_idx"];
$profile_name = $profile_id; $profile_name = $profile_id;
$creator_uid = $row["creator"]; $creator_uid = $row["creator"];
...@@ -122,7 +122,7 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -122,7 +122,7 @@ while ($row = mysql_fetch_array($query_result)) {
echo "<td>$creator_uid</td>"; echo "<td>$creator_uid</td>";
} }
echo " <td>$status</td> echo " <td>$status</td>
<td>$created</td> <td class='format-date'>$created</td>
</tr>\n"; </tr>\n";
} }
echo " </tbody> echo " </tbody>
......
...@@ -129,7 +129,7 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -129,7 +129,7 @@ while ($row = mysql_fetch_array($query_result)) {
$name = $row["name"]; $name = $row["name"];
$pid = $row["pid"]; $pid = $row["pid"];
$desc = $row["description"]; $desc = $row["description"];
$created = $row["created"]; $created = DateStringGMT($row["created"]);
$public = $row["public"]; $public = $row["public"];
$listed = ($row["listed"] ? "Yes" : "No"); $listed = ($row["listed"] ? "Yes" : "No");
$shared = $row["shared"]; $shared = $row["shared"];
...@@ -174,7 +174,7 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -174,7 +174,7 @@ while ($row = mysql_fetch_array($query_result)) {
} }
echo " <td style='white-space:nowrap'>$pid</td> echo " <td style='white-space:nowrap'>$pid</td>
<td>$desc</td> <td>$desc</td>
<td>$created</td> <td class='format-date'>$created</td>
<td>$listed</td> <td>$listed</td>
<td>$privacy</td> <td>$privacy</td>
</tr>\n"; </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