From acedfdd5917bcf59bce253f1533e0f54af8ea4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E5=A4=9C=E6=98=9F=E8=BE=B0?= <156594280+moyexingchen@users.noreply.github.com> Date: Mon, 15 Jan 2024 22:37:53 +0800 Subject: [PATCH] Create common.js --- assets/js/common.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 assets/js/common.js diff --git a/assets/js/common.js b/assets/js/common.js new file mode 100644 index 000000000..266b37fd0 --- /dev/null +++ b/assets/js/common.js @@ -0,0 +1,12 @@ +//获取当前年份 +var getCurrYear = function() { + const nowDate = new Date(); + const currYear = nowDate.getFullYear(); + return currYear; + } + $(function(){ + //加载年份 + var currYear = getCurrYear() + var copyrightText = currYear===2024?'2024':'2024-'+currYear + $("#copyright_year").text(copyrightText) + });