You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
710 B

  1. $(function () {
  2. function switchDateFormat(format) {
  3. $("#log td.datetime").each(function(index, cell) {
  4. var dt = moment(cell.getAttribute("data-raw"));
  5. format == "local" ? dt.local() : dt.utc();
  6. $(".date", cell).text(dt.format("MMM D"));
  7. $(".time", cell).text(dt.format("HH:mm"));
  8. })
  9. }
  10. $("#format-switcher").click(function(ev) {
  11. var format = ev.target.getAttribute("data-format");
  12. switchDateFormat(format);
  13. });
  14. switchDateFormat("local");
  15. // The table is initially hidden to avoid flickering as we convert dates.
  16. // Once it's ready, set it to visible:
  17. $("#log").css("visibility", "visible");
  18. });