[LNT] r282526 - Use jquery to format dates

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 12:05:19 PDT 2016


Author: cmatthews
Date: Tue Sep 27 14:05:18 2016
New Revision: 282526

URL: http://llvm.org/viewvc/llvm-project?rev=282526&view=rev
Log:
Use jquery to format dates

Modified:
    lnt/trunk/lnt/server/ui/templates/layout.html

Modified: lnt/trunk/lnt/server/ui/templates/layout.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/layout.html?rev=282526&r1=282525&r2=282526&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/layout.html (original)
+++ lnt/trunk/lnt/server/ui/templates/layout.html Tue Sep 27 14:05:18 2016
@@ -117,7 +117,27 @@
                     })
                 }
         );
+
+        // Support for long and short dates.
+        var shortDateFormat = 'MMM dd yyyy';
+        var longDateFormat  = 'MMM dd yyyy HH:mm:ss';
+
+        $(".shortDateFormat").each(function (idx, elem) {
+            if ($(elem).is(":input")) {
+                $(elem).val($.format.date($(elem).val(), shortDateFormat));
+            } else {
+                $(elem).text($.format.date($(elem).text(), shortDateFormat));
+            }
+        });
+        $(".longDateFormat").each(function (idx, elem) {
+            if ($(elem).is(":input")) {
+                $(elem).val($.format.date($(elem).val(), longDateFormat));
+            } else {
+                $(elem).text($.format.date($(elem).text(), longDateFormat));
+            }
+        });
     });
+
   </script>
 </head>
 




More information about the llvm-commits mailing list