Skip to content

Commit

Permalink
Create common.js
Browse files Browse the repository at this point in the history
  • Loading branch information
moyexingchen authored Jan 15, 2024
1 parent 693afdf commit acedfdd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions assets/js/common.js
Original file line number Diff line number Diff line change
@@ -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)
});

0 comments on commit acedfdd

Please sign in to comment.