app/assets/javascripts/local_time.js.coffee in local_time-1.0.2 vs app/assets/javascripts/local_time.js.coffee in local_time-1.0.3

- old
+ new

@@ -19,10 +19,29 @@ weekdays = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split " " months = "January February March April May June July August September October November December".split " " pad = (num) -> ('0' + num).slice -2 +parseTimeZone = (time) -> + string = time.toString() + # Sun Aug 30 2015 10:22:57 GMT-0400 (NAME) + if name = string.match(/\(([\w\s]+)\)$/)?[1] + if /\s/.test(name) + # Sun Aug 30 2015 10:22:57 GMT-0400 (Eastern Daylight Time) + name.match(/\b(\w)/g).join("") + else + # Sun Aug 30 2015 10:22:57 GMT-0400 (EDT) + name + # Sun Aug 30 10:22:57 EDT 2015 + else if name = string.match(/(\w{3,4})\s\d{4}$/)?[1] + name + # "Sun Aug 30 10:22:57 UTC-0400 2015" + else if name = string.match(/(UTC[\+\-]\d+)/)?[1] + name + else + "" + strftime = (time, formatString) -> day = time.getDay() date = time.getDate() month = time.getMonth() year = time.getFullYear() @@ -49,10 +68,10 @@ when 'P' then (if hour > 11 then 'pm' else 'am') when 'S' then pad second when 'w' then day when 'y' then pad year % 100 when 'Y' then year - when 'Z' then time.toString().match(/\((\w+)\)$/)?[1] ? '' + when 'Z' then parseTimeZone(time) class CalendarDate @fromDate: (date) -> new this date.getFullYear(), date.getMonth() + 1, date.getDate()