time_crisis 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (615) hide show
  1. data/Rakefile +0 -3
  2. data/VERSION.yml +2 -2
  3. data/lib/time_crisis.rb +13 -25
  4. data/lib/time_crisis/conversions.rb +39 -0
  5. data/lib/{third_base → time_crisis}/date.rb +135 -133
  6. data/lib/{third_base → time_crisis}/datetime.rb +123 -111
  7. data/lib/time_crisis/holiday.rb +8 -6
  8. data/lib/time_crisis/meteorological_seasons.rb +3 -0
  9. data/lib/time_crisis/nth_weekday.rb +10 -15
  10. data/lib/time_crisis/support.rb +13 -8
  11. data/lib/time_crisis/support/basic_object.rb +18 -0
  12. data/lib/time_crisis/support/duration.rb +87 -0
  13. data/lib/time_crisis/support/ext/date/acts_like.rb +9 -0
  14. data/lib/time_crisis/support/ext/date/calculations.rb +183 -0
  15. data/lib/time_crisis/support/ext/date/conversions.rb +60 -0
  16. data/lib/time_crisis/support/ext/date_time/acts_like.rb +13 -0
  17. data/lib/time_crisis/support/ext/date_time/calculations.rb +88 -0
  18. data/lib/time_crisis/support/ext/date_time/conversions.rb +66 -0
  19. data/lib/time_crisis/support/ext/date_time/zones.rb +5 -0
  20. data/lib/time_crisis/support/ext/object/acts_like.rb +5 -0
  21. data/lib/time_crisis/support/ext/object/blank.rb +47 -0
  22. data/lib/time_crisis/support/ext/time/acts_like.rb +9 -0
  23. data/lib/time_crisis/support/ext/time/calculations.rb +228 -0
  24. data/lib/time_crisis/support/ext/time/conversions.rb +58 -0
  25. data/lib/time_crisis/support/ext/time/marshal_with_utc_flag.rb +21 -0
  26. data/lib/time_crisis/support/ext/time/publicize_conversion_methods.rb +9 -0
  27. data/lib/time_crisis/support/ext/time/zones.rb +44 -0
  28. data/lib/time_crisis/support/time_with_zone.rb +272 -0
  29. data/lib/time_crisis/support/values/time_zone.rb +339 -0
  30. data/lib/time_crisis/time.rb +4 -0
  31. data/lib/time_crisis/tzinfo.rb +1 -0
  32. data/lib/time_crisis/tzinfo/definitions/Africa/Abidjan.rb +18 -0
  33. data/lib/time_crisis/tzinfo/definitions/Africa/Accra.rb +33 -0
  34. data/lib/time_crisis/tzinfo/definitions/Africa/Addis_Ababa.rb +20 -0
  35. data/lib/time_crisis/tzinfo/definitions/Africa/Algiers.rb +2 -2
  36. data/lib/time_crisis/tzinfo/definitions/Africa/Asmara.rb +22 -0
  37. data/lib/time_crisis/tzinfo/definitions/Africa/Asmera.rb +13 -0
  38. data/lib/time_crisis/tzinfo/definitions/Africa/Bamako.rb +21 -0
  39. data/lib/time_crisis/tzinfo/definitions/Africa/Bangui.rb +18 -0
  40. data/lib/time_crisis/tzinfo/definitions/Africa/Banjul.rb +22 -0
  41. data/lib/time_crisis/tzinfo/definitions/Africa/Bissau.rb +20 -0
  42. data/lib/time_crisis/tzinfo/definitions/Africa/Blantyre.rb +18 -0
  43. data/lib/time_crisis/tzinfo/definitions/Africa/Brazzaville.rb +18 -0
  44. data/lib/time_crisis/tzinfo/definitions/Africa/Bujumbura.rb +18 -0
  45. data/lib/time_crisis/tzinfo/definitions/Africa/Cairo.rb +2 -2
  46. data/lib/time_crisis/tzinfo/definitions/Africa/Casablanca.rb +2 -2
  47. data/lib/time_crisis/tzinfo/definitions/Africa/Ceuta.rb +172 -0
  48. data/lib/time_crisis/tzinfo/definitions/Africa/Conakry.rb +21 -0
  49. data/lib/time_crisis/tzinfo/definitions/Africa/Dakar.rb +20 -0
  50. data/lib/time_crisis/tzinfo/definitions/Africa/Dar_es_Salaam.rb +21 -0
  51. data/lib/time_crisis/tzinfo/definitions/Africa/Djibouti.rb +18 -0
  52. data/lib/time_crisis/tzinfo/definitions/Africa/Douala.rb +18 -0
  53. data/lib/time_crisis/tzinfo/definitions/Africa/El_Aaiun.rb +20 -0
  54. data/lib/time_crisis/tzinfo/definitions/Africa/Freetown.rb +53 -0
  55. data/lib/time_crisis/tzinfo/definitions/Africa/Gaborone.rb +21 -0
  56. data/lib/time_crisis/tzinfo/definitions/Africa/Harare.rb +2 -2
  57. data/lib/time_crisis/tzinfo/definitions/Africa/Johannesburg.rb +2 -2
  58. data/lib/time_crisis/tzinfo/definitions/Africa/Kampala.rb +23 -0
  59. data/lib/time_crisis/tzinfo/definitions/Africa/Khartoum.rb +53 -0
  60. data/lib/time_crisis/tzinfo/definitions/Africa/Kigali.rb +18 -0
  61. data/lib/time_crisis/tzinfo/definitions/Africa/Kinshasa.rb +18 -0
  62. data/lib/time_crisis/tzinfo/definitions/Africa/Lagos.rb +18 -0
  63. data/lib/time_crisis/tzinfo/definitions/Africa/Libreville.rb +18 -0
  64. data/lib/time_crisis/tzinfo/definitions/Africa/Lome.rb +18 -0
  65. data/lib/time_crisis/tzinfo/definitions/Africa/Luanda.rb +20 -0
  66. data/lib/time_crisis/tzinfo/definitions/Africa/Lubumbashi.rb +18 -0
  67. data/lib/time_crisis/tzinfo/definitions/Africa/Lusaka.rb +18 -0
  68. data/lib/time_crisis/tzinfo/definitions/Africa/Malabo.rb +20 -0
  69. data/lib/time_crisis/tzinfo/definitions/Africa/Maputo.rb +18 -0
  70. data/lib/time_crisis/tzinfo/definitions/Africa/Maseru.rb +21 -0
  71. data/lib/time_crisis/tzinfo/definitions/Africa/Mbabane.rb +18 -0
  72. data/lib/time_crisis/tzinfo/definitions/Africa/Mogadishu.rb +21 -0
  73. data/lib/time_crisis/tzinfo/definitions/Africa/Monrovia.rb +2 -2
  74. data/lib/time_crisis/tzinfo/definitions/Africa/Nairobi.rb +2 -2
  75. data/lib/time_crisis/tzinfo/definitions/Africa/Ndjamena.rb +21 -0
  76. data/lib/time_crisis/tzinfo/definitions/Africa/Niamey.rb +22 -0
  77. data/lib/time_crisis/tzinfo/definitions/Africa/Nouakchott.rb +21 -0
  78. data/lib/time_crisis/tzinfo/definitions/Africa/Ouagadougou.rb +18 -0
  79. data/lib/time_crisis/tzinfo/definitions/Africa/Porto__m__Novo.rb +20 -0
  80. data/lib/time_crisis/tzinfo/definitions/Africa/Sao_Tome.rb +20 -0
  81. data/lib/time_crisis/tzinfo/definitions/Africa/Timbuktu.rb +13 -0
  82. data/lib/time_crisis/tzinfo/definitions/Africa/Tripoli.rb +48 -0
  83. data/lib/time_crisis/tzinfo/definitions/Africa/Tunis.rb +135 -0
  84. data/lib/time_crisis/tzinfo/definitions/Africa/Windhoek.rb +140 -0
  85. data/lib/time_crisis/tzinfo/definitions/America/Adak.rb +196 -0
  86. data/lib/time_crisis/tzinfo/definitions/America/Anchorage.rb +196 -0
  87. data/lib/time_crisis/tzinfo/definitions/America/Anguilla.rb +18 -0
  88. data/lib/time_crisis/tzinfo/definitions/America/Antigua.rb +20 -0
  89. data/lib/time_crisis/tzinfo/definitions/America/Araguaina.rb +67 -0
  90. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +2 -2
  91. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Catamarca.rb +85 -0
  92. data/lib/time_crisis/tzinfo/definitions/America/Argentina/ComodRivadavia.rb +15 -0
  93. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Cordoba.rb +85 -0
  94. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Jujuy.rb +84 -0
  95. data/lib/time_crisis/tzinfo/definitions/America/Argentina/La_Rioja.rb +86 -0
  96. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Mendoza.rb +86 -0
  97. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Rio_Gallegos.rb +85 -0
  98. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Salta.rb +83 -0
  99. data/lib/time_crisis/tzinfo/definitions/America/Argentina/San_Juan.rb +2 -2
  100. data/lib/time_crisis/tzinfo/definitions/America/Argentina/San_Luis.rb +168 -0
  101. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Tucuman.rb +87 -0
  102. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Ushuaia.rb +85 -0
  103. data/lib/time_crisis/tzinfo/definitions/America/Aruba.rb +20 -0
  104. data/lib/time_crisis/tzinfo/definitions/America/Asuncion.rb +174 -0
  105. data/lib/time_crisis/tzinfo/definitions/America/Atikokan.rb +28 -0
  106. data/lib/time_crisis/tzinfo/definitions/America/Atka.rb +13 -0
  107. data/lib/time_crisis/tzinfo/definitions/America/Bahia.rb +77 -0
  108. data/lib/time_crisis/tzinfo/definitions/America/Barbados.rb +29 -0
  109. data/lib/time_crisis/tzinfo/definitions/America/Belem.rb +47 -0
  110. data/lib/time_crisis/tzinfo/definitions/America/Belize.rb +74 -0
  111. data/lib/time_crisis/tzinfo/definitions/America/Blanc__m__Sablon.rb +26 -0
  112. data/lib/time_crisis/tzinfo/definitions/America/Boa_Vista.rb +51 -0
  113. data/lib/time_crisis/tzinfo/definitions/America/Bogota.rb +2 -2
  114. data/lib/time_crisis/tzinfo/definitions/America/Boise.rb +199 -0
  115. data/lib/time_crisis/tzinfo/definitions/America/Buenos_Aires.rb +13 -0
  116. data/lib/time_crisis/tzinfo/definitions/America/Cambridge_Bay.rb +173 -0
  117. data/lib/time_crisis/tzinfo/definitions/America/Campo_Grande.rb +171 -0
  118. data/lib/time_crisis/tzinfo/definitions/America/Cancun.rb +133 -0
  119. data/lib/time_crisis/tzinfo/definitions/America/Caracas.rb +2 -2
  120. data/lib/time_crisis/tzinfo/definitions/America/Catamarca.rb +13 -0
  121. data/lib/time_crisis/tzinfo/definitions/America/Cayenne.rb +20 -0
  122. data/lib/time_crisis/tzinfo/definitions/America/Cayman.rb +20 -0
  123. data/lib/time_crisis/tzinfo/definitions/America/Chicago.rb +2 -2
  124. data/lib/time_crisis/tzinfo/definitions/America/Chihuahua.rb +2 -2
  125. data/lib/time_crisis/tzinfo/definitions/America/Coral_Harbour.rb +13 -0
  126. data/lib/time_crisis/tzinfo/definitions/America/Cordoba.rb +13 -0
  127. data/lib/time_crisis/tzinfo/definitions/America/Costa_Rica.rb +29 -0
  128. data/lib/time_crisis/tzinfo/definitions/America/Cuiaba.rb +169 -0
  129. data/lib/time_crisis/tzinfo/definitions/America/Curacao.rb +20 -0
  130. data/lib/time_crisis/tzinfo/definitions/America/Danmarkshavn.rb +53 -0
  131. data/lib/time_crisis/tzinfo/definitions/America/Dawson.rb +176 -0
  132. data/lib/time_crisis/tzinfo/definitions/America/Dawson_Creek.rb +79 -0
  133. data/lib/time_crisis/tzinfo/definitions/America/Denver.rb +2 -2
  134. data/lib/time_crisis/tzinfo/definitions/America/Detroit.rb +186 -0
  135. data/lib/time_crisis/tzinfo/definitions/America/Dominica.rb +18 -0
  136. data/lib/time_crisis/tzinfo/definitions/America/Edmonton.rb +200 -0
  137. data/lib/time_crisis/tzinfo/definitions/America/Eirunepe.rb +51 -0
  138. data/lib/time_crisis/tzinfo/definitions/America/El_Salvador.rb +23 -0
  139. data/lib/time_crisis/tzinfo/definitions/America/Ensenada.rb +13 -0
  140. data/lib/time_crisis/tzinfo/definitions/America/Fort_Wayne.rb +13 -0
  141. data/lib/time_crisis/tzinfo/definitions/America/Fortaleza.rb +57 -0
  142. data/lib/time_crisis/tzinfo/definitions/America/Glace_Bay.rb +186 -0
  143. data/lib/time_crisis/tzinfo/definitions/America/Godthab.rb +2 -2
  144. data/lib/time_crisis/tzinfo/definitions/America/Goose_Bay.rb +255 -0
  145. data/lib/time_crisis/tzinfo/definitions/America/Grand_Turk.rb +165 -0
  146. data/lib/time_crisis/tzinfo/definitions/America/Grenada.rb +18 -0
  147. data/lib/time_crisis/tzinfo/definitions/America/Guadeloupe.rb +18 -0
  148. data/lib/time_crisis/tzinfo/definitions/America/Guatemala.rb +2 -2
  149. data/lib/time_crisis/tzinfo/definitions/America/Guayaquil.rb +20 -0
  150. data/lib/time_crisis/tzinfo/definitions/America/Guyana.rb +24 -0
  151. data/lib/time_crisis/tzinfo/definitions/America/Halifax.rb +2 -2
  152. data/lib/time_crisis/tzinfo/definitions/America/Havana.rb +201 -0
  153. data/lib/time_crisis/tzinfo/definitions/America/Hermosillo.rb +35 -0
  154. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Indianapolis.rb +2 -2
  155. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Knox.rb +203 -0
  156. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Marengo.rb +153 -0
  157. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Petersburg.rb +166 -0
  158. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Tell_City.rb +151 -0
  159. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Vevay.rb +131 -0
  160. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Vincennes.rb +151 -0
  161. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Winamac.rb +157 -0
  162. data/lib/time_crisis/tzinfo/definitions/America/Indianapolis.rb +13 -0
  163. data/lib/time_crisis/tzinfo/definitions/America/Inuvik.rb +166 -0
  164. data/lib/time_crisis/tzinfo/definitions/America/Iqaluit.rb +170 -0
  165. data/lib/time_crisis/tzinfo/definitions/America/Jamaica.rb +41 -0
  166. data/lib/time_crisis/tzinfo/definitions/America/Jujuy.rb +13 -0
  167. data/lib/time_crisis/tzinfo/definitions/America/Juneau.rb +2 -2
  168. data/lib/time_crisis/tzinfo/definitions/America/Kentucky/Louisville.rb +228 -0
  169. data/lib/time_crisis/tzinfo/definitions/America/Kentucky/Monticello.rb +198 -0
  170. data/lib/time_crisis/tzinfo/definitions/America/Knox_IN.rb +13 -0
  171. data/lib/time_crisis/tzinfo/definitions/America/La_Paz.rb +2 -2
  172. data/lib/time_crisis/tzinfo/definitions/America/Lima.rb +2 -2
  173. data/lib/time_crisis/tzinfo/definitions/America/Los_Angeles.rb +2 -2
  174. data/lib/time_crisis/tzinfo/definitions/America/Louisville.rb +13 -0
  175. data/lib/time_crisis/tzinfo/definitions/America/Maceio.rb +59 -0
  176. data/lib/time_crisis/tzinfo/definitions/America/Managua.rb +36 -0
  177. data/lib/time_crisis/tzinfo/definitions/America/Manaus.rb +49 -0
  178. data/lib/time_crisis/tzinfo/definitions/America/Marigot.rb +13 -0
  179. data/lib/time_crisis/tzinfo/definitions/America/Martinique.rb +23 -0
  180. data/lib/time_crisis/tzinfo/definitions/America/Mazatlan.rb +2 -2
  181. data/lib/time_crisis/tzinfo/definitions/America/Mendoza.rb +13 -0
  182. data/lib/time_crisis/tzinfo/definitions/America/Menominee.rb +190 -0
  183. data/lib/time_crisis/tzinfo/definitions/America/Merida.rb +132 -0
  184. data/lib/time_crisis/tzinfo/definitions/America/Mexico_City.rb +2 -2
  185. data/lib/time_crisis/tzinfo/definitions/America/Miquelon.rb +149 -0
  186. data/lib/time_crisis/tzinfo/definitions/America/Moncton.rb +254 -0
  187. data/lib/time_crisis/tzinfo/definitions/America/Monterrey.rb +2 -2
  188. data/lib/time_crisis/tzinfo/definitions/America/Montevideo.rb +179 -0
  189. data/lib/time_crisis/tzinfo/definitions/America/Montreal.rb +279 -0
  190. data/lib/time_crisis/tzinfo/definitions/America/Montserrat.rb +18 -0
  191. data/lib/time_crisis/tzinfo/definitions/America/Nassau.rb +193 -0
  192. data/lib/time_crisis/tzinfo/definitions/America/New_York.rb +2 -2
  193. data/lib/time_crisis/tzinfo/definitions/America/Nipigon.rb +181 -0
  194. data/lib/time_crisis/tzinfo/definitions/America/Nome.rb +196 -0
  195. data/lib/time_crisis/tzinfo/definitions/America/Noronha.rb +57 -0
  196. data/lib/time_crisis/tzinfo/definitions/America/North_Dakota/Center.rb +200 -0
  197. data/lib/time_crisis/tzinfo/definitions/America/North_Dakota/New_Salem.rb +200 -0
  198. data/lib/time_crisis/tzinfo/definitions/America/Panama.rb +20 -0
  199. data/lib/time_crisis/tzinfo/definitions/America/Pangnirtung.rb +173 -0
  200. data/lib/time_crisis/tzinfo/definitions/America/Paramaribo.rb +26 -0
  201. data/lib/time_crisis/tzinfo/definitions/America/Phoenix.rb +2 -2
  202. data/lib/time_crisis/tzinfo/definitions/America/Port__m__au__m__Prince.rb +55 -0
  203. data/lib/time_crisis/tzinfo/definitions/America/Port_of_Spain.rb +18 -0
  204. data/lib/time_crisis/tzinfo/definitions/America/Porto_Acre.rb +13 -0
  205. data/lib/time_crisis/tzinfo/definitions/America/Porto_Velho.rb +47 -0
  206. data/lib/time_crisis/tzinfo/definitions/America/Puerto_Rico.rb +23 -0
  207. data/lib/time_crisis/tzinfo/definitions/America/Rainy_River.rb +181 -0
  208. data/lib/time_crisis/tzinfo/definitions/America/Rankin_Inlet.rb +165 -0
  209. data/lib/time_crisis/tzinfo/definitions/America/Recife.rb +57 -0
  210. data/lib/time_crisis/tzinfo/definitions/America/Regina.rb +2 -2
  211. data/lib/time_crisis/tzinfo/definitions/America/Resolute.rb +166 -0
  212. data/lib/time_crisis/tzinfo/definitions/America/Rio_Branco.rb +49 -0
  213. data/lib/time_crisis/tzinfo/definitions/America/Rosario.rb +13 -0
  214. data/lib/time_crisis/tzinfo/definitions/America/Santarem.rb +49 -0
  215. data/lib/time_crisis/tzinfo/definitions/America/Santiago.rb +2 -2
  216. data/lib/time_crisis/tzinfo/definitions/America/Santo_Domingo.rb +38 -0
  217. data/lib/time_crisis/tzinfo/definitions/America/Sao_Paulo.rb +2 -2
  218. data/lib/time_crisis/tzinfo/definitions/America/Scoresbysund.rb +163 -0
  219. data/lib/time_crisis/tzinfo/definitions/America/Shiprock.rb +13 -0
  220. data/lib/time_crisis/tzinfo/definitions/America/St_Barthelemy.rb +13 -0
  221. data/lib/time_crisis/tzinfo/definitions/America/St_Johns.rb +2 -2
  222. data/lib/time_crisis/tzinfo/definitions/America/St_Kitts.rb +18 -0
  223. data/lib/time_crisis/tzinfo/definitions/America/St_Lucia.rb +20 -0
  224. data/lib/time_crisis/tzinfo/definitions/America/St_Thomas.rb +18 -0
  225. data/lib/time_crisis/tzinfo/definitions/America/St_Vincent.rb +20 -0
  226. data/lib/time_crisis/tzinfo/definitions/America/Swift_Current.rb +44 -0
  227. data/lib/time_crisis/tzinfo/definitions/America/Tegucigalpa.rb +25 -0
  228. data/lib/time_crisis/tzinfo/definitions/America/Thule.rb +139 -0
  229. data/lib/time_crisis/tzinfo/definitions/America/Thunder_Bay.rb +186 -0
  230. data/lib/time_crisis/tzinfo/definitions/America/Tijuana.rb +2 -2
  231. data/lib/time_crisis/tzinfo/definitions/America/Toronto.rb +279 -0
  232. data/lib/time_crisis/tzinfo/definitions/America/Tortola.rb +18 -0
  233. data/lib/time_crisis/tzinfo/definitions/America/Vancouver.rb +236 -0
  234. data/lib/time_crisis/tzinfo/definitions/America/Virgin.rb +13 -0
  235. data/lib/time_crisis/tzinfo/definitions/America/Whitehorse.rb +176 -0
  236. data/lib/time_crisis/tzinfo/definitions/America/Winnipeg.rb +232 -0
  237. data/lib/time_crisis/tzinfo/definitions/America/Yakutat.rb +193 -0
  238. data/lib/time_crisis/tzinfo/definitions/America/Yellowknife.rb +169 -0
  239. data/lib/time_crisis/tzinfo/definitions/Antarctica/Casey.rb +18 -0
  240. data/lib/time_crisis/tzinfo/definitions/Antarctica/Davis.rb +20 -0
  241. data/lib/time_crisis/tzinfo/definitions/Antarctica/DumontDUrville.rb +21 -0
  242. data/lib/time_crisis/tzinfo/definitions/Antarctica/Mawson.rb +18 -0
  243. data/lib/time_crisis/tzinfo/definitions/Antarctica/McMurdo.rb +171 -0
  244. data/lib/time_crisis/tzinfo/definitions/Antarctica/Palmer.rb +172 -0
  245. data/lib/time_crisis/tzinfo/definitions/Antarctica/Rothera.rb +18 -0
  246. data/lib/time_crisis/tzinfo/definitions/Antarctica/South_Pole.rb +13 -0
  247. data/lib/time_crisis/tzinfo/definitions/Antarctica/Syowa.rb +18 -0
  248. data/lib/time_crisis/tzinfo/definitions/Antarctica/Vostok.rb +18 -0
  249. data/lib/time_crisis/tzinfo/definitions/Arctic/Longyearbyen.rb +13 -0
  250. data/lib/time_crisis/tzinfo/definitions/Asia/Aden.rb +18 -0
  251. data/lib/time_crisis/tzinfo/definitions/Asia/Almaty.rb +2 -2
  252. data/lib/time_crisis/tzinfo/definitions/Asia/Amman.rb +163 -0
  253. data/lib/time_crisis/tzinfo/definitions/Asia/Anadyr.rb +165 -0
  254. data/lib/time_crisis/tzinfo/definitions/Asia/Aqtau.rb +75 -0
  255. data/lib/time_crisis/tzinfo/definitions/Asia/Aqtobe.rb +71 -0
  256. data/lib/time_crisis/tzinfo/definitions/Asia/Ashgabat.rb +48 -0
  257. data/lib/time_crisis/tzinfo/definitions/Asia/Ashkhabad.rb +13 -0
  258. data/lib/time_crisis/tzinfo/definitions/Asia/Baghdad.rb +2 -2
  259. data/lib/time_crisis/tzinfo/definitions/Asia/Bahrain.rb +20 -0
  260. data/lib/time_crisis/tzinfo/definitions/Asia/Baku.rb +2 -2
  261. data/lib/time_crisis/tzinfo/definitions/Asia/Bangkok.rb +2 -2
  262. data/lib/time_crisis/tzinfo/definitions/Asia/Beirut.rb +185 -0
  263. data/lib/time_crisis/tzinfo/definitions/Asia/Bishkek.rb +75 -0
  264. data/lib/time_crisis/tzinfo/definitions/Asia/Brunei.rb +20 -0
  265. data/lib/time_crisis/tzinfo/definitions/Asia/Calcutta.rb +13 -0
  266. data/lib/time_crisis/tzinfo/definitions/Asia/Choibalsan.rb +68 -0
  267. data/lib/time_crisis/tzinfo/definitions/Asia/Chongqing.rb +2 -2
  268. data/lib/time_crisis/tzinfo/definitions/Asia/Chungking.rb +13 -0
  269. data/lib/time_crisis/tzinfo/definitions/Asia/Colombo.rb +2 -2
  270. data/lib/time_crisis/tzinfo/definitions/Asia/Dacca.rb +13 -0
  271. data/lib/time_crisis/tzinfo/definitions/Asia/Damascus.rb +195 -0
  272. data/lib/time_crisis/tzinfo/definitions/Asia/Dhaka.rb +2 -2
  273. data/lib/time_crisis/tzinfo/definitions/Asia/Dili.rb +25 -0
  274. data/lib/time_crisis/tzinfo/definitions/Asia/Dubai.rb +18 -0
  275. data/lib/time_crisis/tzinfo/definitions/Asia/Dushanbe.rb +45 -0
  276. data/lib/time_crisis/tzinfo/definitions/Asia/Gaza.rb +191 -0
  277. data/lib/time_crisis/tzinfo/definitions/Asia/Harbin.rb +37 -0
  278. data/lib/time_crisis/tzinfo/definitions/Asia/Ho_Chi_Minh.rb +23 -0
  279. data/lib/time_crisis/tzinfo/definitions/Asia/Hong_Kong.rb +2 -2
  280. data/lib/time_crisis/tzinfo/definitions/Asia/Hovd.rb +65 -0
  281. data/lib/time_crisis/tzinfo/definitions/Asia/Irkutsk.rb +2 -2
  282. data/lib/time_crisis/tzinfo/definitions/Asia/Istanbul.rb +13 -0
  283. data/lib/time_crisis/tzinfo/definitions/Asia/Jakarta.rb +2 -2
  284. data/lib/time_crisis/tzinfo/definitions/Asia/Jayapura.rb +21 -0
  285. data/lib/time_crisis/tzinfo/definitions/Asia/Jerusalem.rb +2 -2
  286. data/lib/time_crisis/tzinfo/definitions/Asia/Kabul.rb +2 -2
  287. data/lib/time_crisis/tzinfo/definitions/Asia/Kamchatka.rb +2 -2
  288. data/lib/time_crisis/tzinfo/definitions/Asia/Karachi.rb +2 -2
  289. data/lib/time_crisis/tzinfo/definitions/Asia/Kashgar.rb +35 -0
  290. data/lib/time_crisis/tzinfo/definitions/Asia/Kathmandu.rb +2 -2
  291. data/lib/time_crisis/tzinfo/definitions/Asia/Katmandu.rb +13 -0
  292. data/lib/time_crisis/tzinfo/definitions/Asia/Kolkata.rb +2 -2
  293. data/lib/time_crisis/tzinfo/definitions/Asia/Krasnoyarsk.rb +2 -2
  294. data/lib/time_crisis/tzinfo/definitions/Asia/Kuala_Lumpur.rb +2 -2
  295. data/lib/time_crisis/tzinfo/definitions/Asia/Kuching.rb +40 -0
  296. data/lib/time_crisis/tzinfo/definitions/Asia/Kuwait.rb +2 -2
  297. data/lib/time_crisis/tzinfo/definitions/Asia/Macao.rb +13 -0
  298. data/lib/time_crisis/tzinfo/definitions/Asia/Macau.rb +61 -0
  299. data/lib/time_crisis/tzinfo/definitions/Asia/Magadan.rb +2 -2
  300. data/lib/time_crisis/tzinfo/definitions/Asia/Makassar.rb +23 -0
  301. data/lib/time_crisis/tzinfo/definitions/Asia/Manila.rb +30 -0
  302. data/lib/time_crisis/tzinfo/definitions/Asia/Muscat.rb +2 -2
  303. data/lib/time_crisis/tzinfo/definitions/Asia/Nicosia.rb +171 -0
  304. data/lib/time_crisis/tzinfo/definitions/Asia/Novosibirsk.rb +2 -2
  305. data/lib/time_crisis/tzinfo/definitions/Asia/Omsk.rb +163 -0
  306. data/lib/time_crisis/tzinfo/definitions/Asia/Oral.rb +74 -0
  307. data/lib/time_crisis/tzinfo/definitions/Asia/Phnom_Penh.rb +23 -0
  308. data/lib/time_crisis/tzinfo/definitions/Asia/Pontianak.rb +30 -0
  309. data/lib/time_crisis/tzinfo/definitions/Asia/Pyongyang.rb +25 -0
  310. data/lib/time_crisis/tzinfo/definitions/Asia/Qatar.rb +20 -0
  311. data/lib/time_crisis/tzinfo/definitions/Asia/Qyzylorda.rb +73 -0
  312. data/lib/time_crisis/tzinfo/definitions/Asia/Rangoon.rb +2 -2
  313. data/lib/time_crisis/tzinfo/definitions/Asia/Riyadh.rb +2 -2
  314. data/lib/time_crisis/tzinfo/definitions/Asia/Riyadh87.rb +592 -0
  315. data/lib/time_crisis/tzinfo/definitions/Asia/Riyadh88.rb +582 -0
  316. data/lib/time_crisis/tzinfo/definitions/Asia/Riyadh89.rb +582 -0
  317. data/lib/time_crisis/tzinfo/definitions/Asia/Saigon.rb +13 -0
  318. data/lib/time_crisis/tzinfo/definitions/Asia/Sakhalin.rb +166 -0
  319. data/lib/time_crisis/tzinfo/definitions/Asia/Samarkand.rb +47 -0
  320. data/lib/time_crisis/tzinfo/definitions/Asia/Seoul.rb +2 -2
  321. data/lib/time_crisis/tzinfo/definitions/Asia/Shanghai.rb +2 -2
  322. data/lib/time_crisis/tzinfo/definitions/Asia/Singapore.rb +2 -2
  323. data/lib/time_crisis/tzinfo/definitions/Asia/Taipei.rb +2 -2
  324. data/lib/time_crisis/tzinfo/definitions/Asia/Tashkent.rb +2 -2
  325. data/lib/time_crisis/tzinfo/definitions/Asia/Tbilisi.rb +2 -2
  326. data/lib/time_crisis/tzinfo/definitions/Asia/Tehran.rb +2 -2
  327. data/lib/time_crisis/tzinfo/definitions/Asia/Tel_Aviv.rb +13 -0
  328. data/lib/time_crisis/tzinfo/definitions/Asia/Thimbu.rb +13 -0
  329. data/lib/time_crisis/tzinfo/definitions/Asia/Thimphu.rb +20 -0
  330. data/lib/time_crisis/tzinfo/definitions/Asia/Tokyo.rb +2 -2
  331. data/lib/time_crisis/tzinfo/definitions/Asia/Ujung_Pandang.rb +13 -0
  332. data/lib/time_crisis/tzinfo/definitions/Asia/Ulaanbaatar.rb +2 -2
  333. data/lib/time_crisis/tzinfo/definitions/Asia/Ulan_Bator.rb +13 -0
  334. data/lib/time_crisis/tzinfo/definitions/Asia/Urumqi.rb +2 -2
  335. data/lib/time_crisis/tzinfo/definitions/Asia/Vientiane.rb +23 -0
  336. data/lib/time_crisis/tzinfo/definitions/Asia/Vladivostok.rb +2 -2
  337. data/lib/time_crisis/tzinfo/definitions/Asia/Yakutsk.rb +2 -2
  338. data/lib/time_crisis/tzinfo/definitions/Asia/Yekaterinburg.rb +2 -2
  339. data/lib/time_crisis/tzinfo/definitions/Asia/Yerevan.rb +2 -2
  340. data/lib/time_crisis/tzinfo/definitions/Atlantic/Azores.rb +2 -2
  341. data/lib/time_crisis/tzinfo/definitions/Atlantic/Bermuda.rb +173 -0
  342. data/lib/time_crisis/tzinfo/definitions/Atlantic/Canary.rb +163 -0
  343. data/lib/time_crisis/tzinfo/definitions/Atlantic/Cape_Verde.rb +2 -2
  344. data/lib/time_crisis/tzinfo/definitions/Atlantic/Faeroe.rb +13 -0
  345. data/lib/time_crisis/tzinfo/definitions/Atlantic/Faroe.rb +159 -0
  346. data/lib/time_crisis/tzinfo/definitions/Atlantic/Jan_Mayen.rb +13 -0
  347. data/lib/time_crisis/tzinfo/definitions/Atlantic/Madeira.rb +269 -0
  348. data/lib/time_crisis/tzinfo/definitions/Atlantic/Reykjavik.rb +85 -0
  349. data/lib/time_crisis/tzinfo/definitions/Atlantic/South_Georgia.rb +2 -2
  350. data/lib/time_crisis/tzinfo/definitions/Atlantic/St_Helena.rb +20 -0
  351. data/lib/time_crisis/tzinfo/definitions/Atlantic/Stanley.rb +170 -0
  352. data/lib/time_crisis/tzinfo/definitions/Australia/ACT.rb +13 -0
  353. data/lib/time_crisis/tzinfo/definitions/Australia/Adelaide.rb +2 -2
  354. data/lib/time_crisis/tzinfo/definitions/Australia/Brisbane.rb +2 -2
  355. data/lib/time_crisis/tzinfo/definitions/Australia/Broken_Hill.rb +189 -0
  356. data/lib/time_crisis/tzinfo/definitions/Australia/Canberra.rb +13 -0
  357. data/lib/time_crisis/tzinfo/definitions/Australia/Currie.rb +185 -0
  358. data/lib/time_crisis/tzinfo/definitions/Australia/Darwin.rb +2 -2
  359. data/lib/time_crisis/tzinfo/definitions/Australia/Eucla.rb +37 -0
  360. data/lib/time_crisis/tzinfo/definitions/Australia/Hobart.rb +2 -2
  361. data/lib/time_crisis/tzinfo/definitions/Australia/LHI.rb +13 -0
  362. data/lib/time_crisis/tzinfo/definitions/Australia/Lindeman.rb +39 -0
  363. data/lib/time_crisis/tzinfo/definitions/Australia/Lord_Howe.rb +160 -0
  364. data/lib/time_crisis/tzinfo/definitions/Australia/Melbourne.rb +2 -2
  365. data/lib/time_crisis/tzinfo/definitions/Australia/NSW.rb +13 -0
  366. data/lib/time_crisis/tzinfo/definitions/Australia/North.rb +13 -0
  367. data/lib/time_crisis/tzinfo/definitions/Australia/Perth.rb +2 -2
  368. data/lib/time_crisis/tzinfo/definitions/Australia/Queensland.rb +13 -0
  369. data/lib/time_crisis/tzinfo/definitions/Australia/South.rb +13 -0
  370. data/lib/time_crisis/tzinfo/definitions/Australia/Sydney.rb +2 -2
  371. data/lib/time_crisis/tzinfo/definitions/Australia/Tasmania.rb +13 -0
  372. data/lib/time_crisis/tzinfo/definitions/Australia/Victoria.rb +13 -0
  373. data/lib/time_crisis/tzinfo/definitions/Australia/West.rb +13 -0
  374. data/lib/time_crisis/tzinfo/definitions/Australia/Yancowinna.rb +13 -0
  375. data/lib/time_crisis/tzinfo/definitions/Brazil/Acre.rb +13 -0
  376. data/lib/time_crisis/tzinfo/definitions/Brazil/DeNoronha.rb +13 -0
  377. data/lib/time_crisis/tzinfo/definitions/Brazil/East.rb +13 -0
  378. data/lib/time_crisis/tzinfo/definitions/Brazil/West.rb +13 -0
  379. data/lib/time_crisis/tzinfo/definitions/CET.rb +177 -0
  380. data/lib/time_crisis/tzinfo/definitions/CST6CDT.rb +192 -0
  381. data/lib/time_crisis/tzinfo/definitions/Canada/Atlantic.rb +13 -0
  382. data/lib/time_crisis/tzinfo/definitions/Canada/Central.rb +13 -0
  383. data/lib/time_crisis/tzinfo/definitions/Canada/East__m__Saskatchewan.rb +13 -0
  384. data/lib/time_crisis/tzinfo/definitions/Canada/Eastern.rb +13 -0
  385. data/lib/time_crisis/tzinfo/definitions/Canada/Mountain.rb +13 -0
  386. data/lib/time_crisis/tzinfo/definitions/Canada/Newfoundland.rb +13 -0
  387. data/lib/time_crisis/tzinfo/definitions/Canada/Pacific.rb +13 -0
  388. data/lib/time_crisis/tzinfo/definitions/Canada/Saskatchewan.rb +13 -0
  389. data/lib/time_crisis/tzinfo/definitions/Canada/Yukon.rb +13 -0
  390. data/lib/time_crisis/tzinfo/definitions/Chile/Continental.rb +13 -0
  391. data/lib/time_crisis/tzinfo/definitions/Chile/EasterIsland.rb +13 -0
  392. data/lib/time_crisis/tzinfo/definitions/Cuba.rb +11 -0
  393. data/lib/time_crisis/tzinfo/definitions/EET.rb +163 -0
  394. data/lib/time_crisis/tzinfo/definitions/EST.rb +14 -0
  395. data/lib/time_crisis/tzinfo/definitions/EST5EDT.rb +192 -0
  396. data/lib/time_crisis/tzinfo/definitions/Egypt.rb +11 -0
  397. data/lib/time_crisis/tzinfo/definitions/Eire.rb +11 -0
  398. data/lib/time_crisis/tzinfo/definitions/Etc/GMT.rb +16 -0
  399. data/lib/time_crisis/tzinfo/definitions/Etc/GMT0.rb +13 -0
  400. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__0.rb +13 -0
  401. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__1.rb +16 -0
  402. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__10.rb +16 -0
  403. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__11.rb +16 -0
  404. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__12.rb +16 -0
  405. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__13.rb +16 -0
  406. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__14.rb +16 -0
  407. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__2.rb +16 -0
  408. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__3.rb +16 -0
  409. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__4.rb +16 -0
  410. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__5.rb +16 -0
  411. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__6.rb +16 -0
  412. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__7.rb +16 -0
  413. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__8.rb +16 -0
  414. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__9.rb +16 -0
  415. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__0.rb +13 -0
  416. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__1.rb +16 -0
  417. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__10.rb +16 -0
  418. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__11.rb +16 -0
  419. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__12.rb +16 -0
  420. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__2.rb +16 -0
  421. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__3.rb +16 -0
  422. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__4.rb +16 -0
  423. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__5.rb +16 -0
  424. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__6.rb +16 -0
  425. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__7.rb +16 -0
  426. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__8.rb +16 -0
  427. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__9.rb +16 -0
  428. data/lib/time_crisis/tzinfo/definitions/Etc/Greenwich.rb +13 -0
  429. data/lib/time_crisis/tzinfo/definitions/Etc/UCT.rb +16 -0
  430. data/lib/time_crisis/tzinfo/definitions/Etc/UTC.rb +2 -2
  431. data/lib/time_crisis/tzinfo/definitions/Etc/Universal.rb +13 -0
  432. data/lib/time_crisis/tzinfo/definitions/Etc/Zulu.rb +13 -0
  433. data/lib/time_crisis/tzinfo/definitions/Europe/Amsterdam.rb +2 -2
  434. data/lib/time_crisis/tzinfo/definitions/Europe/Andorra.rb +153 -0
  435. data/lib/time_crisis/tzinfo/definitions/Europe/Athens.rb +2 -2
  436. data/lib/time_crisis/tzinfo/definitions/Europe/Belfast.rb +13 -0
  437. data/lib/time_crisis/tzinfo/definitions/Europe/Belgrade.rb +2 -2
  438. data/lib/time_crisis/tzinfo/definitions/Europe/Berlin.rb +2 -2
  439. data/lib/time_crisis/tzinfo/definitions/Europe/Bratislava.rb +1 -1
  440. data/lib/time_crisis/tzinfo/definitions/Europe/Brussels.rb +2 -2
  441. data/lib/time_crisis/tzinfo/definitions/Europe/Bucharest.rb +2 -2
  442. data/lib/time_crisis/tzinfo/definitions/Europe/Budapest.rb +2 -2
  443. data/lib/time_crisis/tzinfo/definitions/Europe/Chisinau.rb +189 -0
  444. data/lib/time_crisis/tzinfo/definitions/Europe/Copenhagen.rb +2 -2
  445. data/lib/time_crisis/tzinfo/definitions/Europe/Dublin.rb +2 -2
  446. data/lib/time_crisis/tzinfo/definitions/Europe/Gibraltar.rb +245 -0
  447. data/lib/time_crisis/tzinfo/definitions/Europe/Guernsey.rb +13 -0
  448. data/lib/time_crisis/tzinfo/definitions/Europe/Helsinki.rb +2 -2
  449. data/lib/time_crisis/tzinfo/definitions/Europe/Isle_of_Man.rb +13 -0
  450. data/lib/time_crisis/tzinfo/definitions/Europe/Istanbul.rb +2 -2
  451. data/lib/time_crisis/tzinfo/definitions/Europe/Jersey.rb +13 -0
  452. data/lib/time_crisis/tzinfo/definitions/Europe/Kaliningrad.rb +181 -0
  453. data/lib/time_crisis/tzinfo/definitions/Europe/Kiev.rb +2 -2
  454. data/lib/time_crisis/tzinfo/definitions/Europe/Lisbon.rb +2 -2
  455. data/lib/time_crisis/tzinfo/definitions/Europe/Ljubljana.rb +1 -1
  456. data/lib/time_crisis/tzinfo/definitions/Europe/London.rb +2 -2
  457. data/lib/time_crisis/tzinfo/definitions/Europe/Luxembourg.rb +231 -0
  458. data/lib/time_crisis/tzinfo/definitions/Europe/Madrid.rb +2 -2
  459. data/lib/time_crisis/tzinfo/definitions/Europe/Malta.rb +213 -0
  460. data/lib/time_crisis/tzinfo/definitions/Europe/Mariehamn.rb +13 -0
  461. data/lib/time_crisis/tzinfo/definitions/Europe/Minsk.rb +2 -2
  462. data/lib/time_crisis/tzinfo/definitions/Europe/Monaco.rb +233 -0
  463. data/lib/time_crisis/tzinfo/definitions/Europe/Moscow.rb +2 -2
  464. data/lib/time_crisis/tzinfo/definitions/Europe/Nicosia.rb +13 -0
  465. data/lib/time_crisis/tzinfo/definitions/Europe/Oslo.rb +185 -0
  466. data/lib/time_crisis/tzinfo/definitions/Europe/Paris.rb +2 -2
  467. data/lib/time_crisis/tzinfo/definitions/Europe/Podgorica.rb +13 -0
  468. data/lib/time_crisis/tzinfo/definitions/Europe/Prague.rb +2 -2
  469. data/lib/time_crisis/tzinfo/definitions/Europe/Riga.rb +2 -2
  470. data/lib/time_crisis/tzinfo/definitions/Europe/Rome.rb +2 -2
  471. data/lib/time_crisis/tzinfo/definitions/Europe/Samara.rb +168 -0
  472. data/lib/time_crisis/tzinfo/definitions/Europe/San_Marino.rb +13 -0
  473. data/lib/time_crisis/tzinfo/definitions/Europe/Sarajevo.rb +1 -1
  474. data/lib/time_crisis/tzinfo/definitions/Europe/Simferopol.rb +170 -0
  475. data/lib/time_crisis/tzinfo/definitions/Europe/Skopje.rb +1 -1
  476. data/lib/time_crisis/tzinfo/definitions/Europe/Sofia.rb +2 -2
  477. data/lib/time_crisis/tzinfo/definitions/Europe/Stockholm.rb +2 -2
  478. data/lib/time_crisis/tzinfo/definitions/Europe/Tallinn.rb +2 -2
  479. data/lib/time_crisis/tzinfo/definitions/Europe/Tirane.rb +177 -0
  480. data/lib/time_crisis/tzinfo/definitions/Europe/Tiraspol.rb +13 -0
  481. data/lib/time_crisis/tzinfo/definitions/Europe/Uzhgorod.rb +168 -0
  482. data/lib/time_crisis/tzinfo/definitions/Europe/Vaduz.rb +159 -0
  483. data/lib/time_crisis/tzinfo/definitions/Europe/Vatican.rb +13 -0
  484. data/lib/time_crisis/tzinfo/definitions/Europe/Vienna.rb +2 -2
  485. data/lib/time_crisis/tzinfo/definitions/Europe/Vilnius.rb +2 -2
  486. data/lib/time_crisis/tzinfo/definitions/Europe/Volgograd.rb +166 -0
  487. data/lib/time_crisis/tzinfo/definitions/Europe/Warsaw.rb +2 -2
  488. data/lib/time_crisis/tzinfo/definitions/Europe/Zagreb.rb +1 -1
  489. data/lib/time_crisis/tzinfo/definitions/Europe/Zaporozhye.rb +171 -0
  490. data/lib/time_crisis/tzinfo/definitions/Europe/Zurich.rb +165 -0
  491. data/lib/time_crisis/tzinfo/definitions/GB.rb +11 -0
  492. data/lib/time_crisis/tzinfo/definitions/GB__m__Eire.rb +11 -0
  493. data/lib/time_crisis/tzinfo/definitions/GMT.rb +11 -0
  494. data/lib/time_crisis/tzinfo/definitions/GMT0.rb +11 -0
  495. data/lib/time_crisis/tzinfo/definitions/GMT__m__0.rb +11 -0
  496. data/lib/time_crisis/tzinfo/definitions/GMT__p__0.rb +11 -0
  497. data/lib/time_crisis/tzinfo/definitions/Greenwich.rb +11 -0
  498. data/lib/time_crisis/tzinfo/definitions/HST.rb +14 -0
  499. data/lib/time_crisis/tzinfo/definitions/Hongkong.rb +11 -0
  500. data/lib/time_crisis/tzinfo/definitions/Iceland.rb +11 -0
  501. data/lib/time_crisis/tzinfo/definitions/Indian/Antananarivo.rb +21 -0
  502. data/lib/time_crisis/tzinfo/definitions/Indian/Chagos.rb +20 -0
  503. data/lib/time_crisis/tzinfo/definitions/Indian/Christmas.rb +18 -0
  504. data/lib/time_crisis/tzinfo/definitions/Indian/Cocos.rb +18 -0
  505. data/lib/time_crisis/tzinfo/definitions/Indian/Comoro.rb +18 -0
  506. data/lib/time_crisis/tzinfo/definitions/Indian/Kerguelen.rb +18 -0
  507. data/lib/time_crisis/tzinfo/definitions/Indian/Mahe.rb +18 -0
  508. data/lib/time_crisis/tzinfo/definitions/Indian/Maldives.rb +20 -0
  509. data/lib/time_crisis/tzinfo/definitions/Indian/Mauritius.rb +23 -0
  510. data/lib/time_crisis/tzinfo/definitions/Indian/Mayotte.rb +18 -0
  511. data/lib/time_crisis/tzinfo/definitions/Indian/Reunion.rb +18 -0
  512. data/lib/time_crisis/tzinfo/definitions/Iran.rb +11 -0
  513. data/lib/time_crisis/tzinfo/definitions/Israel.rb +11 -0
  514. data/lib/time_crisis/tzinfo/definitions/Jamaica.rb +11 -0
  515. data/lib/time_crisis/tzinfo/definitions/Japan.rb +11 -0
  516. data/lib/time_crisis/tzinfo/definitions/Kwajalein.rb +11 -0
  517. data/lib/time_crisis/tzinfo/definitions/Libya.rb +11 -0
  518. data/lib/time_crisis/tzinfo/definitions/MET.rb +177 -0
  519. data/lib/time_crisis/tzinfo/definitions/MST.rb +14 -0
  520. data/lib/time_crisis/tzinfo/definitions/MST7MDT.rb +192 -0
  521. data/lib/time_crisis/tzinfo/definitions/Mexico/BajaNorte.rb +13 -0
  522. data/lib/time_crisis/tzinfo/definitions/Mexico/BajaSur.rb +13 -0
  523. data/lib/time_crisis/tzinfo/definitions/Mexico/General.rb +13 -0
  524. data/lib/time_crisis/tzinfo/definitions/Mideast/Riyadh87.rb +13 -0
  525. data/lib/time_crisis/tzinfo/definitions/Mideast/Riyadh88.rb +13 -0
  526. data/lib/time_crisis/tzinfo/definitions/Mideast/Riyadh89.rb +13 -0
  527. data/lib/time_crisis/tzinfo/definitions/NZ.rb +11 -0
  528. data/lib/time_crisis/tzinfo/definitions/NZ__m__CHAT.rb +11 -0
  529. data/lib/time_crisis/tzinfo/definitions/Navajo.rb +11 -0
  530. data/lib/time_crisis/tzinfo/definitions/PRC.rb +11 -0
  531. data/lib/time_crisis/tzinfo/definitions/PST8PDT.rb +192 -0
  532. data/lib/time_crisis/tzinfo/definitions/Pacific/Apia.rb +25 -0
  533. data/lib/time_crisis/tzinfo/definitions/Pacific/Auckland.rb +2 -2
  534. data/lib/time_crisis/tzinfo/definitions/Pacific/Chatham.rb +171 -0
  535. data/lib/time_crisis/tzinfo/definitions/Pacific/Easter.rb +190 -0
  536. data/lib/time_crisis/tzinfo/definitions/Pacific/Efate.rb +39 -0
  537. data/lib/time_crisis/tzinfo/definitions/Pacific/Enderbury.rb +22 -0
  538. data/lib/time_crisis/tzinfo/definitions/Pacific/Fakaofo.rb +18 -0
  539. data/lib/time_crisis/tzinfo/definitions/Pacific/Fiji.rb +2 -2
  540. data/lib/time_crisis/tzinfo/definitions/Pacific/Funafuti.rb +18 -0
  541. data/lib/time_crisis/tzinfo/definitions/Pacific/Galapagos.rb +20 -0
  542. data/lib/time_crisis/tzinfo/definitions/Pacific/Gambier.rb +18 -0
  543. data/lib/time_crisis/tzinfo/definitions/Pacific/Guadalcanal.rb +18 -0
  544. data/lib/time_crisis/tzinfo/definitions/Pacific/Guam.rb +2 -2
  545. data/lib/time_crisis/tzinfo/definitions/Pacific/Honolulu.rb +2 -2
  546. data/lib/time_crisis/tzinfo/definitions/Pacific/Johnston.rb +16 -0
  547. data/lib/time_crisis/tzinfo/definitions/Pacific/Kiritimati.rb +22 -0
  548. data/lib/time_crisis/tzinfo/definitions/Pacific/Kosrae.rb +21 -0
  549. data/lib/time_crisis/tzinfo/definitions/Pacific/Kwajalein.rb +22 -0
  550. data/lib/time_crisis/tzinfo/definitions/Pacific/Majuro.rb +2 -2
  551. data/lib/time_crisis/tzinfo/definitions/Pacific/Marquesas.rb +18 -0
  552. data/lib/time_crisis/tzinfo/definitions/Pacific/Midway.rb +2 -2
  553. data/lib/time_crisis/tzinfo/definitions/Pacific/Nauru.rb +23 -0
  554. data/lib/time_crisis/tzinfo/definitions/Pacific/Niue.rb +22 -0
  555. data/lib/time_crisis/tzinfo/definitions/Pacific/Norfolk.rb +20 -0
  556. data/lib/time_crisis/tzinfo/definitions/Pacific/Noumea.rb +2 -2
  557. data/lib/time_crisis/tzinfo/definitions/Pacific/Pago_Pago.rb +2 -2
  558. data/lib/time_crisis/tzinfo/definitions/Pacific/Palau.rb +18 -0
  559. data/lib/time_crisis/tzinfo/definitions/Pacific/Pitcairn.rb +20 -0
  560. data/lib/time_crisis/tzinfo/definitions/Pacific/Ponape.rb +18 -0
  561. data/lib/time_crisis/tzinfo/definitions/Pacific/Port_Moresby.rb +2 -2
  562. data/lib/time_crisis/tzinfo/definitions/Pacific/Rarotonga.rb +46 -0
  563. data/lib/time_crisis/tzinfo/definitions/Pacific/Saipan.rb +24 -0
  564. data/lib/time_crisis/tzinfo/definitions/Pacific/Samoa.rb +13 -0
  565. data/lib/time_crisis/tzinfo/definitions/Pacific/Tahiti.rb +18 -0
  566. data/lib/time_crisis/tzinfo/definitions/Pacific/Tarawa.rb +18 -0
  567. data/lib/time_crisis/tzinfo/definitions/Pacific/Tongatapu.rb +2 -2
  568. data/lib/time_crisis/tzinfo/definitions/Pacific/Truk.rb +18 -0
  569. data/lib/time_crisis/tzinfo/definitions/Pacific/Wake.rb +18 -0
  570. data/lib/time_crisis/tzinfo/definitions/Pacific/Wallis.rb +18 -0
  571. data/lib/time_crisis/tzinfo/definitions/Pacific/Yap.rb +13 -0
  572. data/lib/time_crisis/tzinfo/definitions/Poland.rb +11 -0
  573. data/lib/time_crisis/tzinfo/definitions/Portugal.rb +11 -0
  574. data/lib/time_crisis/tzinfo/definitions/ROC.rb +11 -0
  575. data/lib/time_crisis/tzinfo/definitions/ROK.rb +11 -0
  576. data/lib/time_crisis/tzinfo/definitions/Singapore.rb +11 -0
  577. data/lib/time_crisis/tzinfo/definitions/Turkey.rb +11 -0
  578. data/lib/time_crisis/tzinfo/definitions/UCT.rb +11 -0
  579. data/lib/time_crisis/tzinfo/definitions/US/Alaska.rb +13 -0
  580. data/lib/time_crisis/tzinfo/definitions/US/Aleutian.rb +13 -0
  581. data/lib/time_crisis/tzinfo/definitions/US/Arizona.rb +13 -0
  582. data/lib/time_crisis/tzinfo/definitions/US/Central.rb +13 -0
  583. data/lib/time_crisis/tzinfo/definitions/US/East__m__Indiana.rb +13 -0
  584. data/lib/time_crisis/tzinfo/definitions/US/Eastern.rb +13 -0
  585. data/lib/time_crisis/tzinfo/definitions/US/Hawaii.rb +13 -0
  586. data/lib/time_crisis/tzinfo/definitions/US/Indiana__m__Starke.rb +13 -0
  587. data/lib/time_crisis/tzinfo/definitions/US/Michigan.rb +13 -0
  588. data/lib/time_crisis/tzinfo/definitions/US/Mountain.rb +13 -0
  589. data/lib/time_crisis/tzinfo/definitions/US/Pacific.rb +13 -0
  590. data/lib/time_crisis/tzinfo/definitions/US/Pacific__m__New.rb +13 -0
  591. data/lib/time_crisis/tzinfo/definitions/US/Samoa.rb +13 -0
  592. data/lib/time_crisis/tzinfo/definitions/UTC.rb +11 -0
  593. data/lib/time_crisis/tzinfo/definitions/Universal.rb +11 -0
  594. data/lib/time_crisis/tzinfo/definitions/WET.rb +163 -0
  595. data/lib/time_crisis/tzinfo/definitions/W__m__SU.rb +11 -0
  596. data/lib/time_crisis/tzinfo/definitions/Zulu.rb +11 -0
  597. data/lib/time_crisis/tzinfo/indexes/timezones.rb +577 -0
  598. data/lib/time_crisis/tzinfo/time_or_datetime.rb +60 -22
  599. data/lib/time_crisis/tzinfo/timezone_index_definition.rb +50 -0
  600. data/lib/time_crisis/tzinfo/timezone_period.rb +4 -4
  601. data/lib/time_crisis/tzinfo/timezone_proxy.rb +65 -0
  602. data/lib/time_crisis/weekend.rb +2 -1
  603. data/time_crisis.gemspec +469 -20
  604. metadata +471 -35
  605. data/lib/third_base.rb +0 -2
  606. data/lib/third_base/compat.rb +0 -405
  607. data/lib/third_base/compat/date.rb +0 -3
  608. data/lib/third_base/compat/date/format.rb +0 -3
  609. data/lib/time_crisis/ext.rb +0 -60
  610. data/lib/time_crisis/support/acts_like.rb +0 -20
  611. data/lib/time_crisis/support/advance.rb +0 -25
  612. data/lib/time_crisis/support/change.rb +0 -47
  613. data/lib/time_crisis/support/conversions.rb +0 -98
  614. data/lib/time_crisis/support/current.rb +0 -16
  615. data/lib/time_crisis/support/readable_inspect.rb +0 -30
data/Rakefile CHANGED
@@ -10,9 +10,6 @@ begin
10
10
  gem.email = "ttilley@gmail.com"
11
11
  gem.homepage = "http://github.com/ttilley/time_crisis"
12
12
  gem.authors = ["Travis Tilley"]
13
- gem.add_dependency 'third_base'
14
- gem.add_development_dependency "thoughtbot-shoulda"
15
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
13
  end
17
14
  rescue LoadError
18
15
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
- :build:
4
- :minor: 2
3
+ :minor: 3
5
4
  :patch: 0
5
+ :build:
@@ -1,33 +1,21 @@
1
- require 'date'
2
- require 'time'
3
-
4
- require 'third_base'
5
- TimeCrisis = ThirdBase
6
- require 'time_crisis/ext'
7
-
1
+ require 'time_crisis/time'
2
+ require 'time_crisis/date'
3
+ require 'time_crisis/datetime'
8
4
  require 'time_crisis/tzinfo'
9
5
  require 'time_crisis/support'
10
- require 'time_crisis/meteorological_seasons'
6
+ require 'time_crisis/conversions'
11
7
  require 'time_crisis/date_range'
12
8
  require 'time_crisis/named_months'
9
+ require 'time_crisis/meteorological_seasons'
13
10
  require 'time_crisis/weekend'
14
11
  require 'time_crisis/nth_weekday'
15
12
  require 'time_crisis/holiday'
16
13
 
17
- module TimeCrisis
18
- class DateTime
19
- ENVMUTEX = Mutex.new
20
- def for_zone(time_zone)
21
- ENVMUTEX.synchronize do
22
- original_zone = ENV['TZ']
23
- begin
24
- utc_time = self.to_time.utc
25
- ENV['TZ'] = time_zone
26
- utc_time.localtime.to_tc_datetime
27
- ensure
28
- ENV['TZ'] = original_zone
29
- end
30
- end
31
- end
32
- end
33
- end
14
+ ::TimeCrisis::Time.zone_default = ::Time.zone_default if ::Time.respond_to?(:zone_default)
15
+ ::TimeCrisis::Time.zone = ::Time.zone if ::Time.respond_to?(:zone)
16
+ ::TimeCrisis::Time.zone ||= ::Time.now.zone
17
+
18
+ # not sure about making this a default behavior
19
+ TCTime = TimeCrisis::Time
20
+ TCDate = TimeCrisis::Date
21
+ TCDateTime = TimeCrisis::DateTime
@@ -0,0 +1,39 @@
1
+ class ::Date
2
+ def to_tc_date
3
+ TimeCrisis::Date.civil(year, month, day)
4
+ end
5
+
6
+ def to_tc_datetime
7
+ TimeCrisis::DateTime.civil(year, month, day, 0, 0, 0, 0)
8
+ end
9
+ end
10
+
11
+ class ::Time
12
+ def to_tc_date
13
+ TimeCrisis::Date.civil(year, month, day)
14
+ end
15
+
16
+ def to_tc_datetime
17
+ TimeCrisis::DateTime.civil(year, month, day, hour, min, sec, 0, utc_offset)
18
+ end
19
+ end
20
+
21
+ class ::DateTime
22
+ def to_tc_date
23
+ TimeCrisis::Date.civil(year, month, day)
24
+ end
25
+
26
+ def to_tc_datetime
27
+ TimeCrisis::DateTime.civil(year, month, day, hour, min, sec, 0, (offset * 86400).to_i)
28
+ end
29
+ end
30
+
31
+ class ::String
32
+ def to_tc_date(opts={})
33
+ TimeCrisis::Date.parse(self, opts)
34
+ end
35
+
36
+ def to_tc_datetime(opts={})
37
+ TimeCrisis::DateTime.parse(self, opts)
38
+ end
39
+ end
@@ -1,7 +1,9 @@
1
- # Top level module for holding ThirdBase classes.
2
- module ThirdBase
3
- # ThirdBase's date class, a simple class which, unlike the standard
4
- # Date class, does not include any time information.
1
+ require 'time_crisis/time'
2
+
3
+ module TimeCrisis
4
+ # TimeCrisis's date class, a simple class which, unlike the standard
5
+ # Date class, does not include any time information. Taken from
6
+ # ThirdBase by Jeremy Evans.
5
7
  #
6
8
  # This class is significantly faster than the standard Date class
7
9
  # for two reasons. First, it does not depend on the Rational class
@@ -9,13 +11,13 @@ module ThirdBase
9
11
  # dates unless it is necessary.
10
12
  class Date
11
13
  include Comparable
12
-
14
+
13
15
  MONTHNAMES = [nil] + %w(January February March April May June July August September October November December)
14
16
  ABBR_MONTHNAMES = [nil] + %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
15
17
  MONTH_NUM_MAP = {}
16
18
  MONTHNAMES.each_with_index{|x, i| MONTH_NUM_MAP[x.downcase] = i if x}
17
19
  ABBR_MONTHNAMES.each_with_index{|x, i| MONTH_NUM_MAP[x.downcase] = i if x}
18
-
20
+
19
21
  DAYNAMES = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
20
22
  ABBR_DAYNAMES = %w(Sun Mon Tue Wed Thu Fri Sat)
21
23
  DAY_NUM_MAP = {}
@@ -26,72 +28,72 @@ module ThirdBase
26
28
  LEAP_CUMMULATIVE_MONTH_DAYS = {1=>0, 2=>31, 3=>60, 4=>91, 5=>121, 6=>152, 7=>182, 8=>213, 9=>244, 10=>274, 11=>305, 12=>335}
27
29
  DAYS_IN_MONTH = {1=>31, 2=>28, 3=>31, 4=>30, 5=>31, 6=>30, 7=>31, 8=>31, 9=>30, 10=>31, 11=>30, 12=>31}
28
30
  LEAP_DAYS_IN_MONTH = {1=>31, 2=>29, 3=>31, 4=>30, 5=>31, 6=>30, 7=>31, 8=>31, 9=>30, 10=>31, 11=>30, 12=>31}
29
-
31
+
30
32
  MONTHNAME_RE_PATTERN = "(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|january|february|march|april|may|june|july|august|september|october|november|december)"
31
33
  FULL_MONTHNAME_RE_PATTERN = "(january|february|march|april|may|june|july|august|september|october|november|december)"
32
34
  ABBR_MONTHNAME_RE_PATTERN = "(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)"
33
35
  FULL_DAYNAME_RE_PATTERN = "(sunday|monday|tuesday|wednesday|thursday|friday|saturday)"
34
36
  ABBR_DAYNAME_RE_PATTERN = "(sun|mon|tue|wed|thu|fri|sat)"
35
-
37
+
36
38
  PARSER_LIST = []
37
39
  DEFAULT_PARSER_LIST = [:iso, :us, :num]
38
40
  PARSERS = {}
39
41
  DEFAULT_PARSERS = {}
40
- DEFAULT_PARSERS[:iso] = [[%r{\A(-?\d{4})[-./ ](\d\d)[-./ ](\d\d)\z}o, proc{|m| {:civil=>[m[1].to_i, m[2].to_i, m[3].to_i]}}]]
41
- DEFAULT_PARSERS[:us] = [[%r{\A(\d\d?)[-./ ](\d\d?)[-./ ](\d\d(?:\d\d)?)\z}o, proc{|m| {:civil=>[two_digit_year(m[3]), m[1].to_i, m[2].to_i]}}],
42
- [%r{\A(\d\d?)/(\d?\d)\z}o, proc{|m| {:civil=>[Time.now.year, m[1].to_i, m[2].to_i]}}],
43
- [%r{\A#{MONTHNAME_RE_PATTERN}[-./ ](\d\d?)(?:st|nd|rd|th)?,?(?:[-./ ](-?(?:\d\d(?:\d\d)?)))?\z}io, proc{|m| {:civil=>[m[3] ? two_digit_year(m[3]) : Time.now.year, MONTH_NUM_MAP[m[1].downcase], m[2].to_i]}}],
44
- [%r{\A(\d\d?)(?:st|nd|rd|th)?[-./ ]#{MONTHNAME_RE_PATTERN}[-./ ](-?\d{4})\z}io, proc{|m| {:civil=>[m[3].to_i, MONTH_NUM_MAP[m[2].downcase], m[1].to_i]}}],
45
- [%r{\A(-?\d{4})[-./ ]#{MONTHNAME_RE_PATTERN}[-./ ](\d\d?)(?:st|nd|rd|th)?\z}io, proc{|m| {:civil=>[m[1].to_i, MONTH_NUM_MAP[m[2].downcase], m[3].to_i]}}],
46
- [%r{\A#{MONTHNAME_RE_PATTERN}[-./ ](-?\d{4})\z}io, proc{|m| {:civil=>[m[2].to_i, MONTH_NUM_MAP[m[1].downcase], 1]}}],
47
- [%r{\A#{ABBR_DAYNAME_RE_PATTERN} #{ABBR_MONTHNAME_RE_PATTERN} (\d\d?) (-?\d{4})\z}io, proc{|m| {:civil=>[m[4].to_i, MONTH_NUM_MAP[m[2].downcase], m[3].to_i]}}]]
48
- DEFAULT_PARSERS[:eu] = [[%r{\A(\d\d?)[-./ ](\d\d?)[-./ ](\d\d\d\d)\z}o, proc{|m| {:civil=>[m[3].to_i, m[2].to_i, m[1].to_i]}}],
49
- [%r{\A(\d\d?)[-./ ](\d?\d)[-./ ](\d?\d)\z}o, proc{|m| {:civil=>[two_digit_year(m[1]), m[2].to_i, m[3].to_i]}}]]
50
- DEFAULT_PARSERS[:num] = [[%r{\A\d{2,8}\z}o, proc do |m|
51
- m = m[0]
52
- case m.length
53
- when 2
54
- t = Time.now
55
- {:civil=>[t.year, t.mon, m.to_i]}
56
- when 3
57
- {:ordinal=>[Time.now.year, m.to_i]}
58
- when 4
59
- {:civil=>[Time.now.year, m[0..1].to_i, m[2..3].to_i]}
60
- when 5
61
- {:ordinal=>[two_digit_year(m[0..1]), m[2..4].to_i]}
62
- when 6
63
- {:civil=>[two_digit_year(m[0..1]), m[2..3].to_i, m[4..5].to_i]}
64
- when 7
65
- {:ordinal=>[m[0..3].to_i, m[4..6].to_i]}
66
- when 8
67
- {:civil=>[m[0..3].to_i, m[4..5].to_i, m[6..7].to_i]}
68
- end
69
- end
42
+ DEFAULT_PARSERS[:iso] = [[%r{\A(-?\d{4})[-./ ](\d\d)[-./ ](\d\d)\z}o, proc {|m| {:civil=>[m[1].to_i, m[2].to_i, m[3].to_i]}}]]
43
+ DEFAULT_PARSERS[:us] = [[%r{\A(\d\d?)[-./ ](\d\d?)[-./ ](\d\d(?:\d\d)?)\z}o, proc {|m| {:civil=>[two_digit_year(m[3]), m[1].to_i, m[2].to_i]}}],
44
+ [%r{\A(\d\d?)/(\d?\d)\z}o, proc {|m| {:civil=>[Time.now.year, m[1].to_i, m[2].to_i]}}],
45
+ [%r{\A#{MONTHNAME_RE_PATTERN}[-./ ](\d\d?)(?:st|nd|rd|th)?,?(?:[-./ ](-?(?:\d\d(?:\d\d)?)))?\z}io, proc {|m| {:civil=>[m[3] ? two_digit_year(m[3]) : Time.now.year, MONTH_NUM_MAP[m[1].downcase], m[2].to_i]}}],
46
+ [%r{\A(\d\d?)(?:st|nd|rd|th)?[-./ ]#{MONTHNAME_RE_PATTERN}[-./ ](-?\d{4})\z}io, proc {|m| {:civil=>[m[3].to_i, MONTH_NUM_MAP[m[2].downcase], m[1].to_i]}}],
47
+ [%r{\A(-?\d{4})[-./ ]#{MONTHNAME_RE_PATTERN}[-./ ](\d\d?)(?:st|nd|rd|th)?\z}io, proc {|m| {:civil=>[m[1].to_i, MONTH_NUM_MAP[m[2].downcase], m[3].to_i]}}],
48
+ [%r{\A#{MONTHNAME_RE_PATTERN}[-./ ](-?\d{4})\z}io, proc {|m| {:civil=>[m[2].to_i, MONTH_NUM_MAP[m[1].downcase], 1]}}],
49
+ [%r{\A#{ABBR_DAYNAME_RE_PATTERN} #{ABBR_MONTHNAME_RE_PATTERN} (\d\d?) (-?\d{4})\z}io, proc {|m| {:civil=>[m[4].to_i, MONTH_NUM_MAP[m[2].downcase], m[3].to_i]}}]]
50
+ DEFAULT_PARSERS[:eu] = [[%r{\A(\d\d?)[-./ ](\d\d?)[-./ ](\d\d\d\d)\z}o, proc {|m| {:civil=>[m[3].to_i, m[2].to_i, m[1].to_i]}}],
51
+ [%r{\A(\d\d?)[-./ ](\d?\d)[-./ ](\d?\d)\z}o, proc {|m| {:civil=>[two_digit_year(m[1]), m[2].to_i, m[3].to_i]}}]]
52
+ DEFAULT_PARSERS[:num] = [[%r{\A\d{2,8}\z}o, proc {|m|
53
+ m = m[0]
54
+ case m.length
55
+ when 2
56
+ t = Time.now
57
+ {:civil=>[t.year, t.mon, m.to_i]}
58
+ when 3
59
+ {:ordinal=>[Time.now.year, m.to_i]}
60
+ when 4
61
+ {:civil=>[Time.now.year, m[0..1].to_i, m[2..3].to_i]}
62
+ when 5
63
+ {:ordinal=>[two_digit_year(m[0..1]), m[2..4].to_i]}
64
+ when 6
65
+ {:civil=>[two_digit_year(m[0..1]), m[2..3].to_i, m[4..5].to_i]}
66
+ when 7
67
+ {:ordinal=>[m[0..3].to_i, m[4..6].to_i]}
68
+ when 8
69
+ {:civil=>[m[0..3].to_i, m[4..5].to_i, m[6..7].to_i]}
70
+ end
71
+ }
70
72
  ]]
71
-
73
+
72
74
  STRFTIME_RE = /%./o
73
-
74
- STRPTIME_PROC_A = proc{|h,x| h[:cwday] = DAY_NUM_MAP[x.downcase]}
75
- STRPTIME_PROC_B = proc{|h,x| h[:month] = MONTH_NUM_MAP[x.downcase]}
76
- STRPTIME_PROC_C = proc{|h,x| h[:year] ||= x.to_i*100}
77
- STRPTIME_PROC_d = proc{|h,x| h[:day] = x.to_i}
78
- STRPTIME_PROC_G = proc{|h,x| h[:cwyear] = x.to_i}
79
- STRPTIME_PROC_g = proc{|h,x| h[:cwyear] = two_digit_year(x)}
80
- STRPTIME_PROC_j = proc{|h,x| h[:yday] = x.to_i}
81
- STRPTIME_PROC_m = proc{|h,x| h[:month] = x.to_i}
82
- STRPTIME_PROC_u = proc{|h,x| h[:cwday] = x.to_i}
83
- STRPTIME_PROC_V = proc{|h,x| h[:cweek] = x.to_i}
84
- STRPTIME_PROC_y = proc{|h,x| h[:year] = two_digit_year(x)}
85
- STRPTIME_PROC_Y = proc{|h,x| h[:year] = x.to_i}
86
-
75
+
76
+ STRPTIME_PROC_A = proc {|h,x| h[:cwday] = DAY_NUM_MAP[x.downcase]}
77
+ STRPTIME_PROC_B = proc {|h,x| h[:month] = MONTH_NUM_MAP[x.downcase]}
78
+ STRPTIME_PROC_C = proc {|h,x| h[:year] ||= x.to_i*100}
79
+ STRPTIME_PROC_d = proc {|h,x| h[:day] = x.to_i}
80
+ STRPTIME_PROC_G = proc {|h,x| h[:cwyear] = x.to_i}
81
+ STRPTIME_PROC_g = proc {|h,x| h[:cwyear] = two_digit_year(x)}
82
+ STRPTIME_PROC_j = proc {|h,x| h[:yday] = x.to_i}
83
+ STRPTIME_PROC_m = proc {|h,x| h[:month] = x.to_i}
84
+ STRPTIME_PROC_u = proc {|h,x| h[:cwday] = x.to_i}
85
+ STRPTIME_PROC_V = proc {|h,x| h[:cweek] = x.to_i}
86
+ STRPTIME_PROC_y = proc {|h,x| h[:year] = two_digit_year(x)}
87
+ STRPTIME_PROC_Y = proc {|h,x| h[:year] = x.to_i}
88
+
87
89
  UNIXEPOCH = 2440588
88
-
90
+
89
91
  # Public Class Methods
90
-
92
+
91
93
  class << self
92
94
  alias new! new
93
95
  end
94
-
96
+
95
97
  # Add a parser to the parser type. Arguments:
96
98
  # * type - The parser type to which to add the parser, should be a Symbol.
97
99
  # * pattern - Can be either a Regexp or String:
@@ -100,7 +102,7 @@ module ThirdBase
100
102
  # operate identically to strptime.
101
103
  # * Regexp - The regular expression is used directly. In this case, a block must be provided,
102
104
  # or an error is raised.
103
- #
105
+ #
104
106
  # The block, if provided, should take a single MatchData argument. It should return
105
107
  # nil if it cannot successfully parse the string, an instance of this class, or a hash of
106
108
  # values to be passed to new!.
@@ -113,40 +115,40 @@ module ThirdBase
113
115
  end
114
116
  parser_hash[type].unshift([pattern, block])
115
117
  end
116
-
118
+
117
119
  # Add a parser type to the list of parser types.
118
120
  # Should be used if you want to add your own parser
119
121
  # types.
120
122
  def self.add_parser_type(type)
121
123
  parser_hash[type] ||= []
122
124
  end
123
-
125
+
124
126
  # Returns a new Date with the given year, month, and day.
125
127
  def self.civil(year, mon, day)
126
128
  new!(:civil=>[year, mon, day])
127
129
  end
128
-
130
+
129
131
  # Returns a new Date with the given commercial week year,
130
132
  # commercial week, and commercial week day.
131
133
  def self.commercial(cwyear, cweek, cwday=5)
132
134
  new!(:commercial=>[cwyear, cweek, cwday])
133
135
  end
134
-
136
+
135
137
  # Returns a new Date with the given julian date.
136
138
  def self.jd(j)
137
139
  new!(:jd=>j)
138
140
  end
139
-
141
+
140
142
  # Calls civil with the given arguments.
141
143
  def self.new(*args)
142
144
  civil(*args)
143
145
  end
144
-
146
+
145
147
  # Returns a new Date with the given year and day of year.
146
148
  def self.ordinal(year, yday)
147
149
  new!(:ordinal=>[year, yday])
148
150
  end
149
-
151
+
150
152
  # Parses the given string and returns a Date. Raises an ArgumentError if no
151
153
  # parser can correctly parse the date. Takes the following options:
152
154
  #
@@ -164,7 +166,7 @@ module ThirdBase
164
166
  end
165
167
  raise ArgumentError, 'invalid date'
166
168
  end
167
-
169
+
168
170
  # Reset the parsers, parser types, and order of parsers used to the default.
169
171
  def self.reset_parsers!
170
172
  parser_hash.clear
@@ -176,7 +178,7 @@ module ThirdBase
176
178
  end
177
179
  use_parsers(*default_parser_list)
178
180
  end
179
-
181
+
180
182
  # Parse the string using the provided format (or the default format).
181
183
  # Raises an ArgumentError if the format does not match the string.
182
184
  def self.strptime(str, fmt=strptime_default)
@@ -194,14 +196,14 @@ module ThirdBase
194
196
  t = Time.now
195
197
  civil(t.year, t.mon, t.day)
196
198
  end
197
-
199
+
198
200
  # Set the order of parser types to use to the given parser types.
199
201
  def self.use_parsers(*parsers)
200
202
  parser_list.replace(parsers)
201
203
  end
202
-
204
+
203
205
  # Private Class Methods
204
-
206
+
205
207
  def self._expand_strptime_format(v)
206
208
  case v
207
209
  when '%D', '%x' then '%m/%d/%y'
@@ -234,19 +236,19 @@ module ThirdBase
234
236
  else ["%#{v}"]
235
237
  end
236
238
  end
237
-
239
+
238
240
  def self.default_parser_hash
239
241
  DEFAULT_PARSERS
240
242
  end
241
-
243
+
242
244
  def self.default_parser_list
243
245
  DEFAULT_PARSER_LIST
244
246
  end
245
-
247
+
246
248
  def self.expand_strptime_format(fmt)
247
249
  fmt.gsub(STRFTIME_RE){|x| _expand_strptime_format(x)}
248
250
  end
249
-
251
+
250
252
  def self.new_from_parts(date_hash)
251
253
  d = today
252
254
  if date_hash[:year] || date_hash[:yday] || date_hash[:month] || date_hash[:day]
@@ -261,15 +263,15 @@ module ThirdBase
261
263
  raise ArgumentError, 'invalid date'
262
264
  end
263
265
  end
264
-
266
+
265
267
  def self.parser_hash
266
268
  PARSERS
267
269
  end
268
-
270
+
269
271
  def self.parser_list
270
272
  PARSER_LIST
271
273
  end
272
-
274
+
273
275
  def self.parsers(parser_families=nil)
274
276
  (parser_families||parser_list).each do |parser_family|
275
277
  parsers_for_family(parser_family) do |pattern, block|
@@ -277,17 +279,17 @@ module ThirdBase
277
279
  end
278
280
  end
279
281
  end
280
-
282
+
281
283
  def self.parsers_for_family(parser_family)
282
284
  parser_hash[parser_family].each do |pattern, block|
283
285
  yield(pattern, block)
284
286
  end
285
287
  end
286
-
288
+
287
289
  def self.strptime_default
288
290
  '%Y-%m-%d'
289
291
  end
290
-
292
+
291
293
  def self.strptime_pattern_and_block(fmt)
292
294
  blocks = []
293
295
  pattern = Regexp.escape(expand_strptime_format(fmt)).gsub(STRFTIME_RE) do |x|
@@ -304,7 +306,7 @@ module ThirdBase
304
306
  end
305
307
  [/\A#{pattern}\z/i, block]
306
308
  end
307
-
309
+
308
310
  def self.two_digit_year(y)
309
311
  y = if y.length == 2
310
312
  y = y.to_i
@@ -313,13 +315,13 @@ module ThirdBase
313
315
  y.to_i
314
316
  end
315
317
  end
316
-
318
+
317
319
  private_class_method :_expand_strptime_format, :_strptime_part, :default_parser_hash, :default_parser_list, :expand_strptime_format, :new_from_parts, :parser_hash, :parser_list, :parsers, :parsers_for_family, :strptime_default, :strptime_pattern_and_block, :two_digit_year
318
-
320
+
319
321
  reset_parsers!
320
-
322
+
321
323
  # Public Instance Methods
322
-
324
+
323
325
  # Called by Date.new!, Takes a hash with one of the following keys:
324
326
  #
325
327
  # * :civil : should be an array with 3 elements, a year, month, and day
@@ -345,13 +347,13 @@ module ThirdBase
345
347
  raise(ArgumentError, "invalid date format")
346
348
  end
347
349
  end
348
-
350
+
349
351
  # Returns a new date with d number of days added to this date.
350
352
  def +(d)
351
353
  raise(TypeError, "d must be an integer") unless d.is_a?(Integer)
352
354
  jd_to_civil(jd + d)
353
355
  end
354
-
356
+
355
357
  # Returns a new date with d number of days subtracted from this date.
356
358
  # If d is a Date, returns the number of days between the two dates.
357
359
  def -(d)
@@ -363,7 +365,7 @@ module ThirdBase
363
365
  raise TypeError, "d should be #{self.class} or Integer"
364
366
  end
365
367
  end
366
-
368
+
367
369
  # Returns a new date with m number of months added to this date.
368
370
  # If the day of self does not exist in the new month, set the
369
371
  # new day to be the last day of the new month.
@@ -384,12 +386,12 @@ module ThirdBase
384
386
  d = day > ndays ? ndays : day
385
387
  new_civil(y, n, d)
386
388
  end
387
-
389
+
388
390
  # Returns a new date with m number of months subtracted from this date.
389
391
  def <<(m)
390
392
  self >> -m
391
393
  end
392
-
394
+
393
395
  # Compare two dates. If the given date is greater than self, return -1, if it is less,
394
396
  # return 1, and if it is equal, return 0. If given date is a number, compare this date's julian
395
397
  # date to it.
@@ -401,15 +403,15 @@ module ThirdBase
401
403
  d
402
404
  end
403
405
  end
404
-
406
+
405
407
  # Dates are equel only if their year, month, and day match.
406
408
  def ==(date)
407
409
  return false unless Date === date
408
410
  year == date.year and mon == date.mon and day == date.day
409
411
  end
410
412
  alias_method :eql?, :==
411
-
412
- # If d is a date, only true if it is equal to this date. If d is Numeric, only true if it equals this date's julian date.
413
+
414
+ # If d is a date, only true if it is equal to this date. If d is Numeric, only true if it equals this date's julian date.
413
415
  def ===(d)
414
416
  case d
415
417
  when Numeric then jd == d
@@ -417,48 +419,48 @@ module ThirdBase
417
419
  else false
418
420
  end
419
421
  end
420
-
422
+
421
423
  # The commercial week day for this date.
422
424
  def cwday
423
425
  @cwday || commercial[2]
424
426
  end
425
-
427
+
426
428
  # The commercial week for this date.
427
429
  def cweek
428
430
  @cweek || commercial[1]
429
431
  end
430
-
432
+
431
433
  # The commercial week year for this date.
432
434
  def cwyear
433
435
  @cwyear || commercial[0]
434
436
  end
435
-
437
+
436
438
  # The day of the month for this date.
437
439
  def day
438
440
  @day || civil[2]
439
441
  end
440
442
  alias mday day
441
-
443
+
442
444
  # Yield every date between this date and given date to the block. The
443
445
  # given date should be less than this date.
444
446
  def downto(d, &block)
445
447
  step(d, -1, &block)
446
448
  end
447
-
449
+
448
450
  # Unique value for this date, based on it's year, month, and day of month.
449
451
  def hash
450
452
  civil.hash
451
453
  end
452
-
454
+
453
455
  # Programmer friendly readable string, much more friendly than the one
454
456
  # in the standard date class.
455
457
  def inspect
456
458
  "#<#{self.class} #{self}>"
457
459
  end
458
-
460
+
459
461
  # This date's julian date.
460
462
  def jd
461
- @jd ||= (
463
+ @jd ||= (
462
464
  y = year
463
465
  m = mon
464
466
  d = day
@@ -477,13 +479,13 @@ module ThirdBase
477
479
  def leap?
478
480
  _leap?(year)
479
481
  end
480
-
482
+
481
483
  # The month number for this date (January is 1, December is 12).
482
484
  def mon
483
485
  @mon || civil[1]
484
486
  end
485
487
  alias month mon
486
-
488
+
487
489
  # Yield each date between this date and limit, adding step number
488
490
  # of days in each iteration. Returns current date.
489
491
  def step(limit, step=1)
@@ -495,18 +497,18 @@ module ThirdBase
495
497
  end
496
498
  self
497
499
  end
498
-
500
+
499
501
  # Format the time using a format string, or the default format string.
500
502
  def strftime(fmt=strftime_default)
501
503
  fmt.gsub(STRFTIME_RE){|x| _strftime(x[1..1])}
502
504
  end
503
-
505
+
504
506
  # Return the day after this date.
505
507
  def succ
506
508
  self + 1
507
509
  end
508
510
  alias next succ
509
-
511
+
510
512
  # Alias for strftime with the default format
511
513
  def to_s
512
514
  strftime
@@ -517,25 +519,29 @@ module ThirdBase
517
519
  def upto(d, &block)
518
520
  step(d, &block)
519
521
  end
520
-
522
+
521
523
  # Return the day of the week for this date. Sunday is 0, Saturday is 6.
522
524
  def wday
523
525
  (jd + 1) % 7
524
526
  end
525
-
527
+
526
528
  # Return the day of the year for this date. January 1 is 1.
527
529
  def yday
528
530
  h = leap? ? LEAP_CUMMULATIVE_MONTH_DAYS : CUMMULATIVE_MONTH_DAYS
529
531
  @yday ||= h[mon] + day
530
532
  end
531
-
533
+
532
534
  # Return the year for this date.
533
535
  def year
534
536
  @year || civil[0]
535
537
  end
536
538
 
539
+ def days_in_month(m=nil, y=nil)
540
+ (_leap?(y||year) ? LEAP_DAYS_IN_MONTH : DAYS_IN_MONTH)[m||mon]
541
+ end
542
+
537
543
  protected
538
-
544
+
539
545
  def civil
540
546
  unless @year && @mon && @day
541
547
  if @year && @yday
@@ -549,7 +555,7 @@ module ThirdBase
549
555
  end
550
556
  [@year, @mon, @day]
551
557
  end
552
-
558
+
553
559
  def commercial
554
560
  unless @cwyear && @cweek && @cwday
555
561
  a = jd_to_civil(jd - 3).year
@@ -560,13 +566,13 @@ module ThirdBase
560
566
  end
561
567
  [@cwyear, @cweek, @cwday]
562
568
  end
563
-
569
+
564
570
  def ordinal
565
571
  [year, yday]
566
572
  end
567
-
573
+
568
574
  private
569
-
575
+
570
576
  def _leap?(year)
571
577
  if year % 400 == 0
572
578
  true
@@ -578,7 +584,7 @@ module ThirdBase
578
584
  false
579
585
  end
580
586
  end
581
-
587
+
582
588
  def _strftime(v)
583
589
  case v
584
590
  when '%' then '%'
@@ -610,20 +616,16 @@ module ThirdBase
610
616
  else "%#{v}"
611
617
  end
612
618
  end
613
-
619
+
614
620
  def commercial_to_jd(y, w, d)
615
621
  jd = new_civil(y, 1, 4).jd
616
622
  jd - (jd % 7) + 7 * (w - 1) + (d - 1)
617
623
  end
618
-
619
- def days_in_month(m=nil, y=nil)
620
- (_leap?(y||year) ? LEAP_DAYS_IN_MONTH : DAYS_IN_MONTH)[m||mon]
621
- end
622
-
624
+
623
625
  def jd_to_civil(jd)
624
626
  new_civil(*jd_to_ymd(jd))
625
627
  end
626
-
628
+
627
629
  def jd_to_ymd(jd)
628
630
  x = ((jd - 1867216.25) / 36524.25).floor
629
631
  a = jd + 1 + x - (x / 4.0).floor
@@ -641,42 +643,42 @@ module ThirdBase
641
643
  end
642
644
  [y, m, dom]
643
645
  end
644
-
646
+
645
647
  def julian_jd?(jd)
646
648
  jd < 2299161
647
649
  end
648
-
650
+
649
651
  def last_yday
650
652
  leap? ? 366 : 365
651
653
  end
652
-
654
+
653
655
  def month_day_from_yday
654
656
  yday = @yday
655
657
  y = @year
656
658
  h = leap? ? LEAP_CUMMULATIVE_MONTH_DAYS : CUMMULATIVE_MONTH_DAYS
657
659
  12.downto(0) do |i|
658
660
  if (c = h[i]) < yday
659
- return [i, yday - c]
661
+ return [i, yday - c]
660
662
  end
661
663
  end
662
664
  end
663
-
665
+
664
666
  def new_civil(y, m, d)
665
667
  self.class.new(y, m, d)
666
668
  end
667
-
669
+
668
670
  def new_jd(j)
669
671
  self.class.jd(jd)
670
672
  end
671
-
673
+
672
674
  def strftime_default
673
675
  '%Y-%m-%d'
674
676
  end
675
-
677
+
676
678
  def valid_civil?
677
679
  day >= 1 and day <= days_in_month(mon) and mon >= 1 and mon <= 12
678
680
  end
679
-
681
+
680
682
  def valid_commercial?
681
683
  if cwday >= 1 and cwday <= 7 and cweek >= 1 and cweek <= 53
682
684
  new_jd(jd).commercial == commercial
@@ -684,11 +686,11 @@ module ThirdBase
684
686
  false
685
687
  end
686
688
  end
687
-
689
+
688
690
  def valid_ordinal?
689
691
  yday >= 1 and yday <= (_leap?(year) ? 366 : 365)
690
692
  end
691
-
693
+
692
694
  def yday_from_month_day
693
695
  CUMMULATIVE_MONTH_DAYS[mon] + day + ((month > 2 and leap?) ? 1 : 0)
694
696
  end