mirror of
https://github.com/zuiidea/antd-admin
synced 2026-11-17 21:25:06 +00:00
weather
This commit is contained in:
+24
-2
@@ -15,7 +15,29 @@ String.prototype.hyphenToHump = function () {
|
||||
|
||||
// 驼峰转连字符
|
||||
String.prototype.humpToHyphen = function () {
|
||||
return this.replace(/([A-Z])/g,"-$1").toLowerCase()
|
||||
return this.replace(/([A-Z])/g, "-$1").toLowerCase()
|
||||
}
|
||||
|
||||
// 日期格式化
|
||||
Date.prototype.format = function (format) {
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1,
|
||||
"d+": this.getDate(),
|
||||
"h+": this.getHours(),
|
||||
'H+': this.getHours(),
|
||||
"m+": this.getMinutes(),
|
||||
"s+": this.getSeconds(),
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3),
|
||||
"S": this.getMilliseconds()
|
||||
}
|
||||
if (/(y+)/.test(format))
|
||||
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length))
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(format))
|
||||
format = format.replace(RegExp.$1, RegExp.$1.length == 1
|
||||
? o[k]
|
||||
: ("00" + o[k]).substr(("" + o[k]).length))
|
||||
return format
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
@@ -23,5 +45,5 @@ module.exports = {
|
||||
menu,
|
||||
request,
|
||||
color,
|
||||
classnames,
|
||||
classnames
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user