(string)
| 10119 | |
| 10120 | var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; |
| 10121 | function jsonStringToDate(string){ |
| 10122 | var match; |
| 10123 | if (match = string.match(R_ISO8601_STR)) { |
| 10124 | var date = new Date(0), |
| 10125 | tzHour = 0, |
| 10126 | tzMin = 0; |
| 10127 | if (match[9]) { |
| 10128 | tzHour = int(match[9] + match[10]); |
| 10129 | tzMin = int(match[9] + match[11]); |
| 10130 | } |
| 10131 | date.setUTCFullYear(int(match[1]), int(match[2]) - 1, int(match[3])); |
| 10132 | date.setUTCHours(int(match[4]||0) - tzHour, int(match[5]||0) - tzMin, int(match[6]||0), int(match[7]||0)); |
| 10133 | return date; |
| 10134 | } |
| 10135 | return string; |
| 10136 | } |
| 10137 | |
| 10138 | |
| 10139 | return function(date, format) { |
no test coverage detected