aboutsummaryrefslogtreecommitdiffstats
path: root/docs/assets/js/fancydates.js
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-05-03 03:06:50 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-05-03 12:09:27 +0300
commit3a3424774944a421e1b93cbaf533a3500a4d613c (patch)
tree8780bec2bbacde34cf861b7cd4dc11f6f07e813f /docs/assets/js/fancydates.js
parentac8a32e855b078e137fe5de4c2bbf9628c004532 (diff)
downloadck-3a3424774944a421e1b93cbaf533a3500a4d613c.tar.gz
ck-3a3424774944a421e1b93cbaf533a3500a4d613c.tar.bz2
ck-3a3424774944a421e1b93cbaf533a3500a4d613c.zip
add site and .gitignore
Diffstat (limited to 'docs/assets/js/fancydates.js')
-rw-r--r--docs/assets/js/fancydates.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/assets/js/fancydates.js b/docs/assets/js/fancydates.js
new file mode 100644
index 0000000..d13b11b
--- /dev/null
+++ b/docs/assets/js/fancydates.js
@@ -0,0 +1,20 @@
+function fancydates(fanciness, date_format) {
+ if (fanciness == 0) {
+ return;
+ }
+
+ dates = $('time.published.dt-published');
+
+ i = 0;
+ l = dates.length;
+
+ for (i = 0; i < l; i++) {
+ d = moment(dates[i].attributes.datetime.value);
+ if (fanciness == 1) {
+ o = d.local().format(date_format);
+ } else {
+ o = d.fromNow();
+ }
+ dates[i].innerHTML = o;
+ }
+}