Skip to content

Commit

Permalink
fix date filter BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
RubyLouvre committed Nov 21, 2014
1 parent 26b7723 commit eae7bce
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions avalon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4342,12 +4342,12 @@
}
var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
NUMBER_STRING = /^\d+$/
var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/
var riso8601= /^(\d{4})-?(\d+)-?(\d+)(?:T(\d+)(?::?(\d+)(?::?(\d+)(?:\.(\d+))?)?)?(Z|([+-])(\d+):?(\d+))?)?$/
// 1 2 3 4 5 6 7 8 9 10 11

function jsonStringToDate(string) {
var match
if (match = string.match(R_ISO8601_STR)) {
if (match = string.match(riso8601)) {
var date = new Date(0),
tzHour = 0,
tzMin = 0,
Expand Down Expand Up @@ -4382,7 +4382,7 @@
var trimDate = date.trim()
date = trimDate.replace(rfixYMD, function(a, b, c, d) {
var array = d.length === 4 ? [d, b, c] : [b, c, d]
return array.join("/")
return array.join("-")
})
date = jsonStringToDate(date)
}
Expand Down
8 changes: 4 additions & 4 deletions avalon.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions avalon.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -3550,12 +3550,12 @@
}
var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
NUMBER_STRING = /^\d+$/
var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/
var riso8601= /^(\d{4})-?(\d+)-?(\d+)(?:T(\d+)(?::?(\d+)(?::?(\d+)(?:\.(\d+))?)?)?(Z|([+-])(\d+):?(\d+))?)?$/
// 1 2 3 4 5 6 7 8 9 10 11

function jsonStringToDate(string) {
var match
if (match = string.match(R_ISO8601_STR)) {
if (match = string.match(riso8601)) {
var date = new Date(0),
tzHour = 0,
tzMin = 0,
Expand Down Expand Up @@ -3590,7 +3590,7 @@
var trimDate = date.trim()
date = trimDate.replace(rfixYMD, function(a, b, c, d) {
var array = d.length === 4 ? [d, b, c] : [b, c, d]
return array.join("/")
return array.join("-")
})
date = jsonStringToDate(date)
}
Expand Down
4 changes: 2 additions & 2 deletions avalon.modern.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions examples/avalon.shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -4341,12 +4341,12 @@
}
var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
NUMBER_STRING = /^\d+$/
var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/
var riso8601 = /^(\d{4})-?(\d+)-?(\d+)(?:T(\d+)(?::?(\d+)(?::?(\d+)(?:\.(\d+))?)?)?(Z|([+-])(\d+):?(\d+))?)?$/
// 1 2 3 4 5 6 7 8 9 10 11

function jsonStringToDate(string) {
var match
if (match = string.match(R_ISO8601_STR)) {
if (match = string.match(riso8601)) {
var date = new Date(0),
tzHour = 0,
tzMin = 0,
Expand Down Expand Up @@ -4381,7 +4381,7 @@
var trimDate = date.trim()
date = trimDate.replace(rfixYMD, function(a, b, c, d) {
var array = d.length === 4 ? [d, b, c] : [b, c, d]
return array.join("/")
return array.join("-")
})
date = jsonStringToDate(date)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/includeTemplate1.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h1>这是模板1</h1>
<p>生成于{{ 1373021259229 | date("yyyy MM dd:HH:mm:ss")}}</p>
<p>生成于{{ "1373021259229" | date("yyyy MM dd:HH:mm:ss")}}</p>
<p>生成于{{ "2014-06-10 15:21:2" | date("yyyy!MM!dd:HH:mm:ss!")}}</p>

<p>生成于{{ "2014-06-10T15:21:2" | date("yyyy!MM!dd:HH:mm:ss!")}}</p>

<p>值得注意的是,new Date可传的格式类型非常多,但不是所有浏览器都支持这么多,详看<a href="http://dygraphs.com/date-formats.html">这里</a></p>
<div ms-controller="aaa">
Expand Down

0 comments on commit eae7bce

Please sign in to comment.