diff --git a/lib/client.js b/lib/client.js index 9165bde..5f8dbea 100644 --- a/lib/client.js +++ b/lib/client.js @@ -225,12 +225,16 @@ var dateParser = function(isoDate) { //TODO find some regexp help //this method works but it's ooglay var split = isoDate.split(' '); + var dateMatcher = /(\d{4})-(\d{2})-(\d{2})/; + var date = split[0]; var time = split[1]; + var match = dateMatcher.exec(date); var splitDate = date.split('-'); - var year = (splitDate[0]); - var month = parseInt(splitDate[1])-1; - var day = (splitDate[2]); + var year = match[1]; + var month = parseInt(match[2])-1; + var day = match[3]; + var splitTime = time.split(':'); var hour = parseInt(splitTime[0]); var min = splitTime[1];