(string)
| 562 | var R_ISO8061_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?:\:?(\d\d)(?:\:?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/; |
| 563 | |
| 564 | function jsonStringToDate(string) { |
| 565 | var match; |
| 566 | if (match = string.match(R_ISO8061_STR)) { |
| 567 | var date = new Date(0), |
| 568 | tzHour = 0, |
| 569 | tzMin = 0; |
| 570 | if (match[9]) { |
| 571 | tzHour = int(match[9] + match[10]); |
| 572 | tzMin = int(match[9] + match[11]); |
| 573 | } |
| 574 | date.setUTCFullYear(int(match[1]), int(match[2]) - 1, int(match[3])); |
| 575 | date.setUTCHours(int(match[4]||0) - tzHour, |
| 576 | int(match[5]||0) - tzMin, |
| 577 | int(match[6]||0), |
| 578 | int(match[7]||0)); |
| 579 | return date; |
| 580 | } |
| 581 | return string; |
| 582 | } |
| 583 | |
| 584 | function int(str) { |
| 585 | return parseInt(str, 10); |
no test coverage detected