commit
5dafbe8f97
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
Binary file not shown.
After Width: | Height: | Size: 226 KiB |
@ -0,0 +1,28 @@
|
||||
function dateFormat(fmt, date) {
|
||||
let ret;
|
||||
const opt = {
|
||||
"Y+": date.getFullYear().toString(), // 年
|
||||
"m+": (date.getMonth() + 1).toString(), // 月
|
||||
"d+": date.getDate().toString(), // 日
|
||||
"H+": date.getHours().toString(), // 时
|
||||
"M+": date.getMinutes().toString(), // 分
|
||||
"S+": date.getSeconds().toString() // 秒
|
||||
};
|
||||
for (let k in opt) {
|
||||
ret = new RegExp("(" + k + ")").exec(fmt);
|
||||
if (ret) {
|
||||
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
|
||||
};
|
||||
};
|
||||
return fmt;
|
||||
}
|
||||
|
||||
$(function () {
|
||||
var date = new Date()
|
||||
if (dateFormat("YYYY-mm-dd", date) == '2020-04-04') {
|
||||
console.log($('body').length)
|
||||
$('body').css({
|
||||
'-webkit-filter': 'grayscale(100%)'
|
||||
})
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue