jekyll-theme-ici3d 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +50 -0
  4. data/_data/publications/pulliam2012.yml +12 -0
  5. data/_data/team/ackley.yml +25 -0
  6. data/_data/team/are.yml +22 -0
  7. data/_data/team/beauclair.yml +14 -0
  8. data/_data/team/bekele.yml +14 -0
  9. data/_data/team/bellan.yml +46 -0
  10. data/_data/team/bolton.yml +33 -0
  11. data/_data/team/borchering.yml +65 -0
  12. data/_data/team/brook.yml +15 -0
  13. data/_data/team/brown.yml +18 -0
  14. data/_data/team/bruce.yml +26 -0
  15. data/_data/team/brucePA.yml +9 -0
  16. data/_data/team/deleo.yml +49 -0
  17. data/_data/team/delva.yml +15 -0
  18. data/_data/team/dushoff.yml +52 -0
  19. data/_data/team/ervin.yml +10 -0
  20. data/_data/team/faikah.yml +26 -0
  21. data/_data/team/grebe.yml +36 -0
  22. data/_data/team/hargrove.yml +36 -0
  23. data/_data/team/hitchcock.yml +10 -0
  24. data/_data/team/hladish.yml +45 -0
  25. data/_data/team/january.yml +9 -0
  26. data/_data/team/kassanjee.yml +20 -0
  27. data/_data/team/li.yml +45 -0
  28. data/_data/team/lord.yml +20 -0
  29. data/_data/team/marx.yml +14 -0
  30. data/_data/team/mcintosh.yml +20 -0
  31. data/_data/team/mhlanga.yml +22 -0
  32. data/_data/team/mthombothi.yml +23 -0
  33. data/_data/team/mugwagwa.yml +18 -0
  34. data/_data/team/mwangi.yml +24 -0
  35. data/_data/team/mwebaze.yml +20 -0
  36. data/_data/team/ndifon.yml +18 -0
  37. data/_data/team/ngonghala.yml +30 -0
  38. data/_data/team/nondi.yml +14 -0
  39. data/_data/team/nyamai.yml +18 -0
  40. data/_data/team/october.yml +9 -0
  41. data/_data/team/paradza.yml +19 -0
  42. data/_data/team/pearson.yml +58 -0
  43. data/_data/team/porco.yml +14 -0
  44. data/_data/team/pulliam.yml +51 -0
  45. data/_data/team/reiner.yml +18 -0
  46. data/_data/team/scheepers.yml +9 -0
  47. data/_data/team/scott.yml +51 -0
  48. data/_data/team/sempa.yml +32 -0
  49. data/_data/team/sikhondze.yml +14 -0
  50. data/_data/team/template.yml +18 -0
  51. data/_data/team/ujeneza.yml +38 -0
  52. data/_data/team/vanschalkwyk.yml +32 -0
  53. data/_data/team/welte.yml +18 -0
  54. data/_data/team/williams.yml +28 -0
  55. data/_data/team/ying.yml +21 -0
  56. data/_includes/MedPH/.DS_Store +0 -0
  57. data/_includes/MedPH/assignments.md +42 -0
  58. data/_includes/MedPH/assignmentsStandard.md +74 -0
  59. data/_includes/MedPH/computerlabs.md +38 -0
  60. data/_includes/MedPH/computerlabsStandard.md +38 -0
  61. data/_includes/MedPH/lectures.md +12 -0
  62. data/_includes/MedPH/references.md +71 -0
  63. data/_includes/MedPH/schedule.md +85 -0
  64. data/_includes/MedPH/scheduleStandard.md +93 -0
  65. data/_includes/bottomTable.html +5 -0
  66. data/_includes/centerTable.html +5 -0
  67. data/_includes/clinicNavbar.html +46 -0
  68. data/_includes/contact.html +12 -0
  69. data/_includes/directors.html +47 -0
  70. data/_includes/footer.html +23 -0
  71. data/_includes/head.html +28 -0
  72. data/_includes/header.html +31 -0
  73. data/_includes/hero.html +14 -0
  74. data/_includes/index.md +9 -0
  75. data/_includes/mission.html +13 -0
  76. data/_includes/navStructure.html +70 -0
  77. data/_includes/navbar.html +65 -0
  78. data/_includes/outputs.html +74 -0
  79. data/_includes/partners.html +75 -0
  80. data/_includes/profile.html +67 -0
  81. data/_includes/publications/faculty.md +13 -0
  82. data/_includes/publications/instructional.md +5 -0
  83. data/_includes/publications/participant.md +33 -0
  84. data/_includes/talk.html +12 -0
  85. data/_includes/topTable.html +6 -0
  86. data/_includes/upcoming.html +43 -0
  87. data/_layouts/clinic.liquid +43 -0
  88. data/_layouts/example.liquid +601 -0
  89. data/_layouts/main.liquid +34 -0
  90. data/_layouts/medph.page.liquid +60 -0
  91. data/_layouts/page.liquid +41 -0
  92. data/_layouts/people.page.liquid +27 -0
  93. data/_layouts/profile.liquid +44 -0
  94. data/_layouts/redirect.liquid +15 -0
  95. data/_layouts/talk.liquid +42 -0
  96. data/assets/css/academicons.css +249 -0
  97. data/assets/css/academicons.min.css +1 -0
  98. data/assets/css/bootstrap.css +6760 -0
  99. data/assets/css/bootstrap.css.map +1 -0
  100. data/assets/css/bootstrap.min.css +6 -0
  101. data/assets/css/font-awesome.css +2086 -0
  102. data/assets/css/font-awesome.min.css +4 -0
  103. data/assets/css/ie.css +5 -0
  104. data/assets/css/main-one-page.css +6433 -0
  105. data/assets/css/main.css +7160 -0
  106. data/assets/css/my-custom-styles.css +14 -0
  107. data/assets/css/shop-main.css +3117 -0
  108. data/assets/css/skins/brown.css +299 -0
  109. data/assets/css/skins/deepskyblue.css +299 -0
  110. data/assets/css/skins/goldenrod.css +299 -0
  111. data/assets/css/skins/ici3dBlue.css +229 -0
  112. data/assets/css/skins/ici3dBlue.css.map +7 -0
  113. data/assets/css/skins/ici3dIndigo.css +229 -0
  114. data/assets/css/skins/ici3dIndigo.css.map +7 -0
  115. data/assets/css/skins/indianred.css +299 -0
  116. data/assets/css/skins/lightgreen.css +299 -0
  117. data/assets/css/skins/orange.css +299 -0
  118. data/assets/css/skins/seagreen.css +299 -0
  119. data/assets/css/skins/slategray.css +299 -0
  120. data/assets/fonts/academicons.eot +0 -0
  121. data/assets/fonts/academicons.svg +66 -0
  122. data/assets/fonts/academicons.ttf +0 -0
  123. data/assets/fonts/academicons.woff +0 -0
  124. data/assets/fonts/fontawesome-webfont.eot +0 -0
  125. data/assets/fonts/fontawesome-webfont.svg +655 -0
  126. data/assets/fonts/fontawesome-webfont.ttf +0 -0
  127. data/assets/fonts/fontawesome-webfont.woff +0 -0
  128. data/assets/fonts/fontawesome-webfont.woff2 +0 -0
  129. data/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  130. data/assets/fonts/glyphicons-halflings-regular.svg +288 -0
  131. data/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  132. data/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  133. data/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
  134. data/assets/ico/favicon.ico +0 -0
  135. data/assets/ico/favicon.png +0 -0
  136. data/assets/ico/ici3d114x114.png +0 -0
  137. data/assets/ico/ici3d144x144.png +0 -0
  138. data/assets/ico/ici3d57x57.png +0 -0
  139. data/assets/ico/ici3d72x72.png +0 -0
  140. data/assets/img/8hearts.png +0 -0
  141. data/assets/img/MMED2015_tutorials.jpg +0 -0
  142. data/assets/img/badge.png +0 -0
  143. data/assets/img/blog/balloon-med.jpg +0 -0
  144. data/assets/img/blog/balloon.jpg +0 -0
  145. data/assets/img/blog/buildings-med.jpg +0 -0
  146. data/assets/img/blog/buildings.jpg +0 -0
  147. data/assets/img/blog/people-med.jpg +0 -0
  148. data/assets/img/blog/people.jpg +0 -0
  149. data/assets/img/bx_loader.gif +0 -0
  150. data/assets/img/clients/logo1.png +0 -0
  151. data/assets/img/clients/logo2.png +0 -0
  152. data/assets/img/clients/logo3.png +0 -0
  153. data/assets/img/clients/logo4.png +0 -0
  154. data/assets/img/clients/logo5.png +0 -0
  155. data/assets/img/flags/China.png +0 -0
  156. data/assets/img/flags/Germany.png +0 -0
  157. data/assets/img/flags/Japan.png +0 -0
  158. data/assets/img/flags/South-Africa.png +0 -0
  159. data/assets/img/flags/United-Kingdom.png +0 -0
  160. data/assets/img/flags/United-States.png +0 -0
  161. data/assets/img/free.png +0 -0
  162. data/assets/img/fullscreen-bg.jpg +0 -0
  163. data/assets/img/gray_jean.png +0 -0
  164. data/assets/img/hero-unit-bg.png +0 -0
  165. data/assets/img/hero-unit-obj.png +0 -0
  166. data/assets/img/hero-unit-obj2.png +0 -0
  167. data/assets/img/hero-unit-obj3.png +0 -0
  168. data/assets/img/intro-img.png +0 -0
  169. data/assets/img/location-pin.png +0 -0
  170. data/assets/img/logo/ici3d-logo-light.png +0 -0
  171. data/assets/img/logo/ici3d-logo-nav.png +0 -0
  172. data/assets/img/logo/ici3d-logo-white.png +0 -0
  173. data/assets/img/logo/ici3d-logo-white_v2.png +0 -0
  174. data/assets/img/logo/ici3d-logo-white_v3.png +0 -0
  175. data/assets/img/logo/repute-logo-light-brown.png +0 -0
  176. data/assets/img/logo/repute-logo-light-deepskyblue.png +0 -0
  177. data/assets/img/logo/repute-logo-light-goldenrod.png +0 -0
  178. data/assets/img/logo/repute-logo-light-indianred.png +0 -0
  179. data/assets/img/logo/repute-logo-light-lightgreen.png +0 -0
  180. data/assets/img/logo/repute-logo-light-orange.png +0 -0
  181. data/assets/img/logo/repute-logo-light-seagreen.png +0 -0
  182. data/assets/img/logo/repute-logo-light-slategray.png +0 -0
  183. data/assets/img/logo/repute-logo-light.png +0 -0
  184. data/assets/img/logo/repute-logo-nav-brown.png +0 -0
  185. data/assets/img/logo/repute-logo-nav-deepskyblue.png +0 -0
  186. data/assets/img/logo/repute-logo-nav-goldenrod.png +0 -0
  187. data/assets/img/logo/repute-logo-nav-indianred.png +0 -0
  188. data/assets/img/logo/repute-logo-nav-light.png +0 -0
  189. data/assets/img/logo/repute-logo-nav-lightgreen.png +0 -0
  190. data/assets/img/logo/repute-logo-nav-orange.png +0 -0
  191. data/assets/img/logo/repute-logo-nav-seagreen.png +0 -0
  192. data/assets/img/logo/repute-logo-nav-slategray.png +0 -0
  193. data/assets/img/logo/repute-logo-nav.png +0 -0
  194. data/assets/img/mentors/are.jpg +0 -0
  195. data/assets/img/mentors/bolton.jpg +0 -0
  196. data/assets/img/mentors/brown.jpg +0 -0
  197. data/assets/img/mentors/kassanjee.jpg +0 -0
  198. data/assets/img/mentors/mhlanga.jpg +0 -0
  199. data/assets/img/mentors/nyamai.png +0 -0
  200. data/assets/img/news/featured-news.png +0 -0
  201. data/assets/img/news/news1.png +0 -0
  202. data/assets/img/news/news2.png +0 -0
  203. data/assets/img/news/news3.png +0 -0
  204. data/assets/img/news/news4.png +0 -0
  205. data/assets/img/news/news5.png +0 -0
  206. data/assets/img/other/snoep.jpg +0 -0
  207. data/assets/img/page-header-bg.png +0 -0
  208. data/assets/img/participants/SempaJB.jpg +0 -0
  209. data/assets/img/partners/AIMS-SA.jpg +0 -0
  210. data/assets/img/partners/CEMA_UN.pdf +0 -0
  211. data/assets/img/partners/CEMA_UN.png +0 -0
  212. data/assets/img/partners/CIDID.png +0 -0
  213. data/assets/img/partners/CIDID_long.png +0 -0
  214. data/assets/img/partners/Colby.png +0 -0
  215. data/assets/img/partners/MIDAS.png +0 -0
  216. data/assets/img/partners/McMaster.jpg +0 -0
  217. data/assets/img/partners/PSU.png +0 -0
  218. data/assets/img/partners/Proctor.png +0 -0
  219. data/assets/img/partners/SACEMA_228.png +0 -0
  220. data/assets/img/partners/UCSF.png +0 -0
  221. data/assets/img/partners/UF.png +0 -0
  222. data/assets/img/partners/UGA_228.png +0 -0
  223. data/assets/img/pattern-geometry.png +0 -0
  224. data/assets/img/portfolio/800x500/work1.png +0 -0
  225. data/assets/img/portfolio/800x500/work2.png +0 -0
  226. data/assets/img/portfolio/800x500/work3.png +0 -0
  227. data/assets/img/portfolio/800x500/work4.png +0 -0
  228. data/assets/img/portfolio/800x500/work5.png +0 -0
  229. data/assets/img/portfolio/800x500/work6.png +0 -0
  230. data/assets/img/portfolio/800x500/work7.png +0 -0
  231. data/assets/img/portfolio/800x500/work8.png +0 -0
  232. data/assets/img/portfolio/800x800/work1.png +0 -0
  233. data/assets/img/portfolio/800x800/work2.png +0 -0
  234. data/assets/img/portfolio/800x800/work3.png +0 -0
  235. data/assets/img/portfolio/800x800/work4.png +0 -0
  236. data/assets/img/portfolio/800x800/work5.png +0 -0
  237. data/assets/img/portfolio/800x800/work6.png +0 -0
  238. data/assets/img/portfolio/800x800/work7.png +0 -0
  239. data/assets/img/portfolio/800x800/work8.png +0 -0
  240. data/assets/img/portfolio/single/bicycle.jpg +0 -0
  241. data/assets/img/portfolio/single/blurred_lines.jpg +0 -0
  242. data/assets/img/portfolio/single/edge.jpg +0 -0
  243. data/assets/img/scholars/ackley.jpg +0 -0
  244. data/assets/img/scholars/beauclair.jpg +0 -0
  245. data/assets/img/scholars/beauclair.png +0 -0
  246. data/assets/img/scholars/bekele.jpg +0 -0
  247. data/assets/img/scholars/lord.jpg +0 -0
  248. data/assets/img/scholars/marx.jpg +0 -0
  249. data/assets/img/scholars/mcintosh.jpg +0 -0
  250. data/assets/img/scholars/mwebaze.jpg +0 -0
  251. data/assets/img/scholars/nondi.jpg +0 -0
  252. data/assets/img/scholars/sempa.jpg +0 -0
  253. data/assets/img/scholars/ying.jpg +0 -0
  254. data/assets/img/sliders/full-slide-color.jpg +0 -0
  255. data/assets/img/sliders/full-slide-color2.jpg +0 -0
  256. data/assets/img/sliders/full-slide-color3.jpg +0 -0
  257. data/assets/img/sliders/full-slide.jpg +0 -0
  258. data/assets/img/sliders/full-slide2.jpg +0 -0
  259. data/assets/img/sliders/full-slide3.jpg +0 -0
  260. data/assets/img/sliders/slider1-h500.png +0 -0
  261. data/assets/img/sliders/slider2-h500.png +0 -0
  262. data/assets/img/sliders/slider3-h500.png +0 -0
  263. data/assets/img/team/bellan.jpg +0 -0
  264. data/assets/img/team/borchering.jpg +0 -0
  265. data/assets/img/team/brook.jpg +0 -0
  266. data/assets/img/team/bruce.jpg +0 -0
  267. data/assets/img/team/deleo.jpg +0 -0
  268. data/assets/img/team/delva.jpg +0 -0
  269. data/assets/img/team/dushoff.jpg +0 -0
  270. data/assets/img/team/ervin.jpg +0 -0
  271. data/assets/img/team/grebe.jpg +0 -0
  272. data/assets/img/team/hargrove.jpg +0 -0
  273. data/assets/img/team/hitchcock.jpg +0 -0
  274. data/assets/img/team/hladish.jpg +0 -0
  275. data/assets/img/team/january.jpg +0 -0
  276. data/assets/img/team/li.jpg +0 -0
  277. data/assets/img/team/mthombothi.jpg +0 -0
  278. data/assets/img/team/mugwagwa.jpg +0 -0
  279. data/assets/img/team/mwangi.png +0 -0
  280. data/assets/img/team/ndifon.jpg +0 -0
  281. data/assets/img/team/ngonghala.jpg +0 -0
  282. data/assets/img/team/october.jpg +0 -0
  283. data/assets/img/team/paradza.jpg +0 -0
  284. data/assets/img/team/pearson.jpg +0 -0
  285. data/assets/img/team/porco.jpg +0 -0
  286. data/assets/img/team/pulliam.jpg +0 -0
  287. data/assets/img/team/reiner.jpg +0 -0
  288. data/assets/img/team/scheepers.jpg +0 -0
  289. data/assets/img/team/scott.jpg +0 -0
  290. data/assets/img/team/ujeneza.jpg +0 -0
  291. data/assets/img/team/vanschalkwyk.jpg +0 -0
  292. data/assets/img/team/welte.jpg +0 -0
  293. data/assets/img/team/williams.jpg +0 -0
  294. data/assets/img/testimonial-bg.png +0 -0
  295. data/assets/img/transmission.png +0 -0
  296. data/assets/js/bootstrap.js +2363 -0
  297. data/assets/js/bootstrap.min.js +7 -0
  298. data/assets/js/jquery-2.1.1.min.js +4 -0
  299. data/assets/js/plugins/autohidingnavbar/jquery.bootstrap-autohidingnavbar.js +213 -0
  300. data/assets/js/plugins/autohidingnavbar/jquery.bootstrap-autohidingnavbar.min.js +9 -0
  301. data/assets/js/plugins/bootstrap-datepicker/bootstrap-datepicker.js +474 -0
  302. data/assets/js/plugins/bootstrap-multiselect/bootstrap-multiselect.js +994 -0
  303. data/assets/js/plugins/daterangepicker/daterangepicker.js +868 -0
  304. data/assets/js/plugins/easing/jquery.easing.js +205 -0
  305. data/assets/js/plugins/easing/jquery.easing.min.js +71 -0
  306. data/assets/js/plugins/fitvids/jquery.fitvids.js +83 -0
  307. data/assets/js/plugins/google-map/google-map.js +160 -0
  308. data/assets/js/plugins/isotope/isotope.pkgd.js +4049 -0
  309. data/assets/js/plugins/isotope/isotope.pkgd.min.js +8 -0
  310. data/assets/js/plugins/jquery-cycle/jquery.cycle.all.js +1543 -0
  311. data/assets/js/plugins/jquery-easypiechart/jquery.easypiechart.js +359 -0
  312. data/assets/js/plugins/jquery-easypiechart/jquery.easypiechart.min.js +9 -0
  313. data/assets/js/plugins/jquery-maskedinput/jquery.masked-input.js +338 -0
  314. data/assets/js/plugins/jquery-maskedinput/jquery.masked-input.min.js +7 -0
  315. data/assets/js/plugins/maximage/jquery.maximage.js +697 -0
  316. data/assets/js/plugins/maximage/jquery.maximage.min.js +4 -0
  317. data/assets/js/plugins/moment/moment.js +1662 -0
  318. data/assets/js/plugins/moment/moment.min.js +6 -0
  319. data/assets/js/plugins/parsley-validation/parsley.js +2074 -0
  320. data/assets/js/plugins/parsley-validation/parsley.min.js +9 -0
  321. data/assets/js/plugins/scrollto/jquery.localscroll-1.2.7-min.js +9 -0
  322. data/assets/js/plugins/scrollto/jquery.localscroll-1.2.7.js +133 -0
  323. data/assets/js/plugins/scrollto/jquery.scrollTo-1.4.3.1-min.js +7 -0
  324. data/assets/js/plugins/scrollto/jquery.scrollTo-1.4.3.1.js +218 -0
  325. data/assets/js/plugins/slick/slick.js +2643 -0
  326. data/assets/js/plugins/slick/slick.min.js +18 -0
  327. data/assets/js/plugins/stellar/jquery.stellar.js +660 -0
  328. data/assets/js/plugins/stellar/jquery.stellar.min.js +2 -0
  329. data/assets/js/repute-scripts.js +539 -0
  330. metadata +385 -0
@@ -0,0 +1,1662 @@
1
+ // moment.js
2
+ // version : 2.1.0
3
+ // author : Tim Wood
4
+ // license : MIT
5
+ // momentjs.com
6
+
7
+ (function (undefined) {
8
+
9
+ /************************************
10
+ Constants
11
+ ************************************/
12
+
13
+ var moment,
14
+ VERSION = "2.1.0",
15
+ round = Math.round, i,
16
+ // internal storage for language config files
17
+ languages = {},
18
+
19
+ // check for nodeJS
20
+ hasModule = (typeof module !== 'undefined' && module.exports),
21
+
22
+ // ASP.NET json date format regex
23
+ aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
24
+ aspNetTimeSpanJsonRegex = /(\-)?(\d*)?\.?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,
25
+
26
+ // format tokens
27
+ formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,
28
+ localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
29
+
30
+ // parsing token regexes
31
+ parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99
32
+ parseTokenOneToThreeDigits = /\d{1,3}/, // 0 - 999
33
+ parseTokenThreeDigits = /\d{3}/, // 000 - 999
34
+ parseTokenFourDigits = /\d{1,4}/, // 0 - 9999
35
+ parseTokenSixDigits = /[+\-]?\d{1,6}/, // -999,999 - 999,999
36
+ parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic.
37
+ parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/i, // +00:00 -00:00 +0000 -0000 or Z
38
+ parseTokenT = /T/i, // T (ISO seperator)
39
+ parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
40
+
41
+ // preliminary iso regex
42
+ // 0000-00-00 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000
43
+ isoRegex = /^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,
44
+ isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
45
+
46
+ // iso time formats and regexes
47
+ isoTimes = [
48
+ ['HH:mm:ss.S', /(T| )\d\d:\d\d:\d\d\.\d{1,3}/],
49
+ ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
50
+ ['HH:mm', /(T| )\d\d:\d\d/],
51
+ ['HH', /(T| )\d\d/]
52
+ ],
53
+
54
+ // timezone chunker "+10:00" > ["10", "00"] or "-1530" > ["-15", "30"]
55
+ parseTimezoneChunker = /([\+\-]|\d\d)/gi,
56
+
57
+ // getter and setter names
58
+ proxyGettersAndSetters = 'Date|Hours|Minutes|Seconds|Milliseconds'.split('|'),
59
+ unitMillisecondFactors = {
60
+ 'Milliseconds' : 1,
61
+ 'Seconds' : 1e3,
62
+ 'Minutes' : 6e4,
63
+ 'Hours' : 36e5,
64
+ 'Days' : 864e5,
65
+ 'Months' : 2592e6,
66
+ 'Years' : 31536e6
67
+ },
68
+
69
+ unitAliases = {
70
+ ms : 'millisecond',
71
+ s : 'second',
72
+ m : 'minute',
73
+ h : 'hour',
74
+ d : 'day',
75
+ w : 'week',
76
+ M : 'month',
77
+ y : 'year'
78
+ },
79
+
80
+ // format function strings
81
+ formatFunctions = {},
82
+
83
+ // tokens to ordinalize and pad
84
+ ordinalizeTokens = 'DDD w W M D d'.split(' '),
85
+ paddedTokens = 'M D H h m s w W'.split(' '),
86
+
87
+ formatTokenFunctions = {
88
+ M : function () {
89
+ return this.month() + 1;
90
+ },
91
+ MMM : function (format) {
92
+ return this.lang().monthsShort(this, format);
93
+ },
94
+ MMMM : function (format) {
95
+ return this.lang().months(this, format);
96
+ },
97
+ D : function () {
98
+ return this.date();
99
+ },
100
+ DDD : function () {
101
+ return this.dayOfYear();
102
+ },
103
+ d : function () {
104
+ return this.day();
105
+ },
106
+ dd : function (format) {
107
+ return this.lang().weekdaysMin(this, format);
108
+ },
109
+ ddd : function (format) {
110
+ return this.lang().weekdaysShort(this, format);
111
+ },
112
+ dddd : function (format) {
113
+ return this.lang().weekdays(this, format);
114
+ },
115
+ w : function () {
116
+ return this.week();
117
+ },
118
+ W : function () {
119
+ return this.isoWeek();
120
+ },
121
+ YY : function () {
122
+ return leftZeroFill(this.year() % 100, 2);
123
+ },
124
+ YYYY : function () {
125
+ return leftZeroFill(this.year(), 4);
126
+ },
127
+ YYYYY : function () {
128
+ return leftZeroFill(this.year(), 5);
129
+ },
130
+ gg : function () {
131
+ return leftZeroFill(this.weekYear() % 100, 2);
132
+ },
133
+ gggg : function () {
134
+ return this.weekYear();
135
+ },
136
+ ggggg : function () {
137
+ return leftZeroFill(this.weekYear(), 5);
138
+ },
139
+ GG : function () {
140
+ return leftZeroFill(this.isoWeekYear() % 100, 2);
141
+ },
142
+ GGGG : function () {
143
+ return this.isoWeekYear();
144
+ },
145
+ GGGGG : function () {
146
+ return leftZeroFill(this.isoWeekYear(), 5);
147
+ },
148
+ e : function () {
149
+ return this.weekday();
150
+ },
151
+ E : function () {
152
+ return this.isoWeekday();
153
+ },
154
+ a : function () {
155
+ return this.lang().meridiem(this.hours(), this.minutes(), true);
156
+ },
157
+ A : function () {
158
+ return this.lang().meridiem(this.hours(), this.minutes(), false);
159
+ },
160
+ H : function () {
161
+ return this.hours();
162
+ },
163
+ h : function () {
164
+ return this.hours() % 12 || 12;
165
+ },
166
+ m : function () {
167
+ return this.minutes();
168
+ },
169
+ s : function () {
170
+ return this.seconds();
171
+ },
172
+ S : function () {
173
+ return ~~(this.milliseconds() / 100);
174
+ },
175
+ SS : function () {
176
+ return leftZeroFill(~~(this.milliseconds() / 10), 2);
177
+ },
178
+ SSS : function () {
179
+ return leftZeroFill(this.milliseconds(), 3);
180
+ },
181
+ Z : function () {
182
+ var a = -this.zone(),
183
+ b = "+";
184
+ if (a < 0) {
185
+ a = -a;
186
+ b = "-";
187
+ }
188
+ return b + leftZeroFill(~~(a / 60), 2) + ":" + leftZeroFill(~~a % 60, 2);
189
+ },
190
+ ZZ : function () {
191
+ var a = -this.zone(),
192
+ b = "+";
193
+ if (a < 0) {
194
+ a = -a;
195
+ b = "-";
196
+ }
197
+ return b + leftZeroFill(~~(10 * a / 6), 4);
198
+ },
199
+ z : function () {
200
+ return this.zoneAbbr();
201
+ },
202
+ zz : function () {
203
+ return this.zoneName();
204
+ },
205
+ X : function () {
206
+ return this.unix();
207
+ }
208
+ };
209
+
210
+ function padToken(func, count) {
211
+ return function (a) {
212
+ return leftZeroFill(func.call(this, a), count);
213
+ };
214
+ }
215
+ function ordinalizeToken(func, period) {
216
+ return function (a) {
217
+ return this.lang().ordinal(func.call(this, a), period);
218
+ };
219
+ }
220
+
221
+ while (ordinalizeTokens.length) {
222
+ i = ordinalizeTokens.pop();
223
+ formatTokenFunctions[i + 'o'] = ordinalizeToken(formatTokenFunctions[i], i);
224
+ }
225
+ while (paddedTokens.length) {
226
+ i = paddedTokens.pop();
227
+ formatTokenFunctions[i + i] = padToken(formatTokenFunctions[i], 2);
228
+ }
229
+ formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3);
230
+
231
+
232
+ /************************************
233
+ Constructors
234
+ ************************************/
235
+
236
+ function Language() {
237
+
238
+ }
239
+
240
+ // Moment prototype object
241
+ function Moment(config) {
242
+ extend(this, config);
243
+ }
244
+
245
+ // Duration Constructor
246
+ function Duration(duration) {
247
+ var years = duration.years || duration.year || duration.y || 0,
248
+ months = duration.months || duration.month || duration.M || 0,
249
+ weeks = duration.weeks || duration.week || duration.w || 0,
250
+ days = duration.days || duration.day || duration.d || 0,
251
+ hours = duration.hours || duration.hour || duration.h || 0,
252
+ minutes = duration.minutes || duration.minute || duration.m || 0,
253
+ seconds = duration.seconds || duration.second || duration.s || 0,
254
+ milliseconds = duration.milliseconds || duration.millisecond || duration.ms || 0;
255
+
256
+ // store reference to input for deterministic cloning
257
+ this._input = duration;
258
+
259
+ // representation for dateAddRemove
260
+ this._milliseconds = milliseconds +
261
+ seconds * 1e3 + // 1000
262
+ minutes * 6e4 + // 1000 * 60
263
+ hours * 36e5; // 1000 * 60 * 60
264
+ // Because of dateAddRemove treats 24 hours as different from a
265
+ // day when working around DST, we need to store them separately
266
+ this._days = days +
267
+ weeks * 7;
268
+ // It is impossible translate months into days without knowing
269
+ // which months you are are talking about, so we have to store
270
+ // it separately.
271
+ this._months = months +
272
+ years * 12;
273
+
274
+ this._data = {};
275
+
276
+ this._bubble();
277
+ }
278
+
279
+
280
+ /************************************
281
+ Helpers
282
+ ************************************/
283
+
284
+
285
+ function extend(a, b) {
286
+ for (var i in b) {
287
+ if (b.hasOwnProperty(i)) {
288
+ a[i] = b[i];
289
+ }
290
+ }
291
+ return a;
292
+ }
293
+
294
+ function absRound(number) {
295
+ if (number < 0) {
296
+ return Math.ceil(number);
297
+ } else {
298
+ return Math.floor(number);
299
+ }
300
+ }
301
+
302
+ // left zero fill a number
303
+ // see http://jsperf.com/left-zero-filling for performance comparison
304
+ function leftZeroFill(number, targetLength) {
305
+ var output = number + '';
306
+ while (output.length < targetLength) {
307
+ output = '0' + output;
308
+ }
309
+ return output;
310
+ }
311
+
312
+ // helper function for _.addTime and _.subtractTime
313
+ function addOrSubtractDurationFromMoment(mom, duration, isAdding, ignoreUpdateOffset) {
314
+ var milliseconds = duration._milliseconds,
315
+ days = duration._days,
316
+ months = duration._months,
317
+ minutes,
318
+ hours,
319
+ currentDate;
320
+
321
+ if (milliseconds) {
322
+ mom._d.setTime(+mom._d + milliseconds * isAdding);
323
+ }
324
+ // store the minutes and hours so we can restore them
325
+ if (days || months) {
326
+ minutes = mom.minute();
327
+ hours = mom.hour();
328
+ }
329
+ if (days) {
330
+ mom.date(mom.date() + days * isAdding);
331
+ }
332
+ if (months) {
333
+ mom.month(mom.month() + months * isAdding);
334
+ }
335
+ if (milliseconds && !ignoreUpdateOffset) {
336
+ moment.updateOffset(mom);
337
+ }
338
+ // restore the minutes and hours after possibly changing dst
339
+ if (days || months) {
340
+ mom.minute(minutes);
341
+ mom.hour(hours);
342
+ }
343
+ }
344
+
345
+ // check if is an array
346
+ function isArray(input) {
347
+ return Object.prototype.toString.call(input) === '[object Array]';
348
+ }
349
+
350
+ // compare two arrays, return the number of differences
351
+ function compareArrays(array1, array2) {
352
+ var len = Math.min(array1.length, array2.length),
353
+ lengthDiff = Math.abs(array1.length - array2.length),
354
+ diffs = 0,
355
+ i;
356
+ for (i = 0; i < len; i++) {
357
+ if (~~array1[i] !== ~~array2[i]) {
358
+ diffs++;
359
+ }
360
+ }
361
+ return diffs + lengthDiff;
362
+ }
363
+
364
+ function normalizeUnits(units) {
365
+ return units ? unitAliases[units] || units.toLowerCase().replace(/(.)s$/, '$1') : units;
366
+ }
367
+
368
+
369
+ /************************************
370
+ Languages
371
+ ************************************/
372
+
373
+
374
+ Language.prototype = {
375
+ set : function (config) {
376
+ var prop, i;
377
+ for (i in config) {
378
+ prop = config[i];
379
+ if (typeof prop === 'function') {
380
+ this[i] = prop;
381
+ } else {
382
+ this['_' + i] = prop;
383
+ }
384
+ }
385
+ },
386
+
387
+ _months : "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
388
+ months : function (m) {
389
+ return this._months[m.month()];
390
+ },
391
+
392
+ _monthsShort : "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
393
+ monthsShort : function (m) {
394
+ return this._monthsShort[m.month()];
395
+ },
396
+
397
+ monthsParse : function (monthName) {
398
+ var i, mom, regex;
399
+
400
+ if (!this._monthsParse) {
401
+ this._monthsParse = [];
402
+ }
403
+
404
+ for (i = 0; i < 12; i++) {
405
+ // make the regex if we don't have it already
406
+ if (!this._monthsParse[i]) {
407
+ mom = moment([2000, i]);
408
+ regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
409
+ this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
410
+ }
411
+ // test the regex
412
+ if (this._monthsParse[i].test(monthName)) {
413
+ return i;
414
+ }
415
+ }
416
+ },
417
+
418
+ _weekdays : "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
419
+ weekdays : function (m) {
420
+ return this._weekdays[m.day()];
421
+ },
422
+
423
+ _weekdaysShort : "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
424
+ weekdaysShort : function (m) {
425
+ return this._weekdaysShort[m.day()];
426
+ },
427
+
428
+ _weekdaysMin : "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
429
+ weekdaysMin : function (m) {
430
+ return this._weekdaysMin[m.day()];
431
+ },
432
+
433
+ weekdaysParse : function (weekdayName) {
434
+ var i, mom, regex;
435
+
436
+ if (!this._weekdaysParse) {
437
+ this._weekdaysParse = [];
438
+ }
439
+
440
+ for (i = 0; i < 7; i++) {
441
+ // make the regex if we don't have it already
442
+ if (!this._weekdaysParse[i]) {
443
+ mom = moment([2000, 1]).day(i);
444
+ regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
445
+ this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
446
+ }
447
+ // test the regex
448
+ if (this._weekdaysParse[i].test(weekdayName)) {
449
+ return i;
450
+ }
451
+ }
452
+ },
453
+
454
+ _longDateFormat : {
455
+ LT : "h:mm A",
456
+ L : "MM/DD/YYYY",
457
+ LL : "MMMM D YYYY",
458
+ LLL : "MMMM D YYYY LT",
459
+ LLLL : "dddd, MMMM D YYYY LT"
460
+ },
461
+ longDateFormat : function (key) {
462
+ var output = this._longDateFormat[key];
463
+ if (!output && this._longDateFormat[key.toUpperCase()]) {
464
+ output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
465
+ return val.slice(1);
466
+ });
467
+ this._longDateFormat[key] = output;
468
+ }
469
+ return output;
470
+ },
471
+
472
+ isPM : function (input) {
473
+ return ((input + '').toLowerCase()[0] === 'p');
474
+ },
475
+
476
+ _meridiemParse : /[ap]\.?m?\.?/i,
477
+ meridiem : function (hours, minutes, isLower) {
478
+ if (hours > 11) {
479
+ return isLower ? 'pm' : 'PM';
480
+ } else {
481
+ return isLower ? 'am' : 'AM';
482
+ }
483
+ },
484
+
485
+ _calendar : {
486
+ sameDay : '[Today at] LT',
487
+ nextDay : '[Tomorrow at] LT',
488
+ nextWeek : 'dddd [at] LT',
489
+ lastDay : '[Yesterday at] LT',
490
+ lastWeek : '[Last] dddd [at] LT',
491
+ sameElse : 'L'
492
+ },
493
+ calendar : function (key, mom) {
494
+ var output = this._calendar[key];
495
+ return typeof output === 'function' ? output.apply(mom) : output;
496
+ },
497
+
498
+ _relativeTime : {
499
+ future : "in %s",
500
+ past : "%s ago",
501
+ s : "a few seconds",
502
+ m : "a minute",
503
+ mm : "%d minutes",
504
+ h : "an hour",
505
+ hh : "%d hours",
506
+ d : "a day",
507
+ dd : "%d days",
508
+ M : "a month",
509
+ MM : "%d months",
510
+ y : "a year",
511
+ yy : "%d years"
512
+ },
513
+ relativeTime : function (number, withoutSuffix, string, isFuture) {
514
+ var output = this._relativeTime[string];
515
+ return (typeof output === 'function') ?
516
+ output(number, withoutSuffix, string, isFuture) :
517
+ output.replace(/%d/i, number);
518
+ },
519
+ pastFuture : function (diff, output) {
520
+ var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
521
+ return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
522
+ },
523
+
524
+ ordinal : function (number) {
525
+ return this._ordinal.replace("%d", number);
526
+ },
527
+ _ordinal : "%d",
528
+
529
+ preparse : function (string) {
530
+ return string;
531
+ },
532
+
533
+ postformat : function (string) {
534
+ return string;
535
+ },
536
+
537
+ week : function (mom) {
538
+ return weekOfYear(mom, this._week.dow, this._week.doy).week;
539
+ },
540
+ _week : {
541
+ dow : 0, // Sunday is the first day of the week.
542
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
543
+ }
544
+ };
545
+
546
+ // Loads a language definition into the `languages` cache. The function
547
+ // takes a key and optionally values. If not in the browser and no values
548
+ // are provided, it will load the language file module. As a convenience,
549
+ // this function also returns the language values.
550
+ function loadLang(key, values) {
551
+ values.abbr = key;
552
+ if (!languages[key]) {
553
+ languages[key] = new Language();
554
+ }
555
+ languages[key].set(values);
556
+ return languages[key];
557
+ }
558
+
559
+ // Determines which language definition to use and returns it.
560
+ //
561
+ // With no parameters, it will return the global language. If you
562
+ // pass in a language key, such as 'en', it will return the
563
+ // definition for 'en', so long as 'en' has already been loaded using
564
+ // moment.lang.
565
+ function getLangDefinition(key) {
566
+ if (!key) {
567
+ return moment.fn._lang;
568
+ }
569
+ if (!languages[key] && hasModule) {
570
+ try {
571
+ require('./lang/' + key);
572
+ } catch (e) {
573
+ // call with no params to set to default
574
+ return moment.fn._lang;
575
+ }
576
+ }
577
+ return languages[key];
578
+ }
579
+
580
+
581
+ /************************************
582
+ Formatting
583
+ ************************************/
584
+
585
+
586
+ function removeFormattingTokens(input) {
587
+ if (input.match(/\[.*\]/)) {
588
+ return input.replace(/^\[|\]$/g, "");
589
+ }
590
+ return input.replace(/\\/g, "");
591
+ }
592
+
593
+ function makeFormatFunction(format) {
594
+ var array = format.match(formattingTokens), i, length;
595
+
596
+ for (i = 0, length = array.length; i < length; i++) {
597
+ if (formatTokenFunctions[array[i]]) {
598
+ array[i] = formatTokenFunctions[array[i]];
599
+ } else {
600
+ array[i] = removeFormattingTokens(array[i]);
601
+ }
602
+ }
603
+
604
+ return function (mom) {
605
+ var output = "";
606
+ for (i = 0; i < length; i++) {
607
+ output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
608
+ }
609
+ return output;
610
+ };
611
+ }
612
+
613
+ // format date using native date object
614
+ function formatMoment(m, format) {
615
+ var i = 5;
616
+
617
+ function replaceLongDateFormatTokens(input) {
618
+ return m.lang().longDateFormat(input) || input;
619
+ }
620
+
621
+ while (i-- && localFormattingTokens.test(format)) {
622
+ format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
623
+ }
624
+
625
+ if (!formatFunctions[format]) {
626
+ formatFunctions[format] = makeFormatFunction(format);
627
+ }
628
+
629
+ return formatFunctions[format](m);
630
+ }
631
+
632
+
633
+ /************************************
634
+ Parsing
635
+ ************************************/
636
+
637
+
638
+ // get the regex to find the next token
639
+ function getParseRegexForToken(token, config) {
640
+ switch (token) {
641
+ case 'DDDD':
642
+ return parseTokenThreeDigits;
643
+ case 'YYYY':
644
+ return parseTokenFourDigits;
645
+ case 'YYYYY':
646
+ return parseTokenSixDigits;
647
+ case 'S':
648
+ case 'SS':
649
+ case 'SSS':
650
+ case 'DDD':
651
+ return parseTokenOneToThreeDigits;
652
+ case 'MMM':
653
+ case 'MMMM':
654
+ case 'dd':
655
+ case 'ddd':
656
+ case 'dddd':
657
+ return parseTokenWord;
658
+ case 'a':
659
+ case 'A':
660
+ return getLangDefinition(config._l)._meridiemParse;
661
+ case 'X':
662
+ return parseTokenTimestampMs;
663
+ case 'Z':
664
+ case 'ZZ':
665
+ return parseTokenTimezone;
666
+ case 'T':
667
+ return parseTokenT;
668
+ case 'MM':
669
+ case 'DD':
670
+ case 'YY':
671
+ case 'HH':
672
+ case 'hh':
673
+ case 'mm':
674
+ case 'ss':
675
+ case 'M':
676
+ case 'D':
677
+ case 'd':
678
+ case 'H':
679
+ case 'h':
680
+ case 'm':
681
+ case 's':
682
+ return parseTokenOneOrTwoDigits;
683
+ default :
684
+ return new RegExp(token.replace('\\', ''));
685
+ }
686
+ }
687
+
688
+ function timezoneMinutesFromString(string) {
689
+ var tzchunk = (parseTokenTimezone.exec(string) || [])[0],
690
+ parts = (tzchunk + '').match(parseTimezoneChunker) || ['-', 0, 0],
691
+ minutes = +(parts[1] * 60) + ~~parts[2];
692
+
693
+ return parts[0] === '+' ? -minutes : minutes;
694
+ }
695
+
696
+ // function to convert string input to date
697
+ function addTimeToArrayFromToken(token, input, config) {
698
+ var a, datePartArray = config._a;
699
+
700
+ switch (token) {
701
+ // MONTH
702
+ case 'M' : // fall through to MM
703
+ case 'MM' :
704
+ datePartArray[1] = (input == null) ? 0 : ~~input - 1;
705
+ break;
706
+ case 'MMM' : // fall through to MMMM
707
+ case 'MMMM' :
708
+ a = getLangDefinition(config._l).monthsParse(input);
709
+ // if we didn't find a month name, mark the date as invalid.
710
+ if (a != null) {
711
+ datePartArray[1] = a;
712
+ } else {
713
+ config._isValid = false;
714
+ }
715
+ break;
716
+ // DAY OF MONTH
717
+ case 'D' : // fall through to DDDD
718
+ case 'DD' : // fall through to DDDD
719
+ case 'DDD' : // fall through to DDDD
720
+ case 'DDDD' :
721
+ if (input != null) {
722
+ datePartArray[2] = ~~input;
723
+ }
724
+ break;
725
+ // YEAR
726
+ case 'YY' :
727
+ datePartArray[0] = ~~input + (~~input > 68 ? 1900 : 2000);
728
+ break;
729
+ case 'YYYY' :
730
+ case 'YYYYY' :
731
+ datePartArray[0] = ~~input;
732
+ break;
733
+ // AM / PM
734
+ case 'a' : // fall through to A
735
+ case 'A' :
736
+ config._isPm = getLangDefinition(config._l).isPM(input);
737
+ break;
738
+ // 24 HOUR
739
+ case 'H' : // fall through to hh
740
+ case 'HH' : // fall through to hh
741
+ case 'h' : // fall through to hh
742
+ case 'hh' :
743
+ datePartArray[3] = ~~input;
744
+ break;
745
+ // MINUTE
746
+ case 'm' : // fall through to mm
747
+ case 'mm' :
748
+ datePartArray[4] = ~~input;
749
+ break;
750
+ // SECOND
751
+ case 's' : // fall through to ss
752
+ case 'ss' :
753
+ datePartArray[5] = ~~input;
754
+ break;
755
+ // MILLISECOND
756
+ case 'S' :
757
+ case 'SS' :
758
+ case 'SSS' :
759
+ datePartArray[6] = ~~ (('0.' + input) * 1000);
760
+ break;
761
+ // UNIX TIMESTAMP WITH MS
762
+ case 'X':
763
+ config._d = new Date(parseFloat(input) * 1000);
764
+ break;
765
+ // TIMEZONE
766
+ case 'Z' : // fall through to ZZ
767
+ case 'ZZ' :
768
+ config._useUTC = true;
769
+ config._tzm = timezoneMinutesFromString(input);
770
+ break;
771
+ }
772
+
773
+ // if the input is null, the date is not valid
774
+ if (input == null) {
775
+ config._isValid = false;
776
+ }
777
+ }
778
+
779
+ // convert an array to a date.
780
+ // the array should mirror the parameters below
781
+ // note: all values past the year are optional and will default to the lowest possible value.
782
+ // [year, month, day , hour, minute, second, millisecond]
783
+ function dateFromArray(config) {
784
+ var i, date, input = [];
785
+
786
+ if (config._d) {
787
+ return;
788
+ }
789
+
790
+ for (i = 0; i < 7; i++) {
791
+ config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
792
+ }
793
+
794
+ // add the offsets to the time to be parsed so that we can have a clean array for checking isValid
795
+ input[3] += ~~((config._tzm || 0) / 60);
796
+ input[4] += ~~((config._tzm || 0) % 60);
797
+
798
+ date = new Date(0);
799
+
800
+ if (config._useUTC) {
801
+ date.setUTCFullYear(input[0], input[1], input[2]);
802
+ date.setUTCHours(input[3], input[4], input[5], input[6]);
803
+ } else {
804
+ date.setFullYear(input[0], input[1], input[2]);
805
+ date.setHours(input[3], input[4], input[5], input[6]);
806
+ }
807
+
808
+ config._d = date;
809
+ }
810
+
811
+ // date from string and format string
812
+ function makeDateFromStringAndFormat(config) {
813
+ // This array is used to make a Date, either with `new Date` or `Date.UTC`
814
+ var tokens = config._f.match(formattingTokens),
815
+ string = config._i,
816
+ i, parsedInput;
817
+
818
+ config._a = [];
819
+
820
+ for (i = 0; i < tokens.length; i++) {
821
+ parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];
822
+ if (parsedInput) {
823
+ string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
824
+ }
825
+ // don't parse if its not a known token
826
+ if (formatTokenFunctions[tokens[i]]) {
827
+ addTimeToArrayFromToken(tokens[i], parsedInput, config);
828
+ }
829
+ }
830
+
831
+ // add remaining unparsed input to the string
832
+ if (string) {
833
+ config._il = string;
834
+ }
835
+
836
+ // handle am pm
837
+ if (config._isPm && config._a[3] < 12) {
838
+ config._a[3] += 12;
839
+ }
840
+ // if is 12 am, change hours to 0
841
+ if (config._isPm === false && config._a[3] === 12) {
842
+ config._a[3] = 0;
843
+ }
844
+ // return
845
+ dateFromArray(config);
846
+ }
847
+
848
+ // date from string and array of format strings
849
+ function makeDateFromStringAndArray(config) {
850
+ var tempConfig,
851
+ tempMoment,
852
+ bestMoment,
853
+
854
+ scoreToBeat = 99,
855
+ i,
856
+ currentScore;
857
+
858
+ for (i = 0; i < config._f.length; i++) {
859
+ tempConfig = extend({}, config);
860
+ tempConfig._f = config._f[i];
861
+ makeDateFromStringAndFormat(tempConfig);
862
+ tempMoment = new Moment(tempConfig);
863
+
864
+ currentScore = compareArrays(tempConfig._a, tempMoment.toArray());
865
+
866
+ // if there is any input that was not parsed
867
+ // add a penalty for that format
868
+ if (tempMoment._il) {
869
+ currentScore += tempMoment._il.length;
870
+ }
871
+
872
+ if (currentScore < scoreToBeat) {
873
+ scoreToBeat = currentScore;
874
+ bestMoment = tempMoment;
875
+ }
876
+ }
877
+
878
+ extend(config, bestMoment);
879
+ }
880
+
881
+ // date from iso format
882
+ function makeDateFromString(config) {
883
+ var i,
884
+ string = config._i,
885
+ match = isoRegex.exec(string);
886
+
887
+ if (match) {
888
+ // match[2] should be "T" or undefined
889
+ config._f = 'YYYY-MM-DD' + (match[2] || " ");
890
+ for (i = 0; i < 4; i++) {
891
+ if (isoTimes[i][1].exec(string)) {
892
+ config._f += isoTimes[i][0];
893
+ break;
894
+ }
895
+ }
896
+ if (parseTokenTimezone.exec(string)) {
897
+ config._f += " Z";
898
+ }
899
+ makeDateFromStringAndFormat(config);
900
+ } else {
901
+ config._d = new Date(string);
902
+ }
903
+ }
904
+
905
+ function makeDateFromInput(config) {
906
+ var input = config._i,
907
+ matched = aspNetJsonRegex.exec(input);
908
+
909
+ if (input === undefined) {
910
+ config._d = new Date();
911
+ } else if (matched) {
912
+ config._d = new Date(+matched[1]);
913
+ } else if (typeof input === 'string') {
914
+ makeDateFromString(config);
915
+ } else if (isArray(input)) {
916
+ config._a = input.slice(0);
917
+ dateFromArray(config);
918
+ } else {
919
+ config._d = input instanceof Date ? new Date(+input) : new Date(input);
920
+ }
921
+ }
922
+
923
+
924
+ /************************************
925
+ Relative Time
926
+ ************************************/
927
+
928
+
929
+ // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
930
+ function substituteTimeAgo(string, number, withoutSuffix, isFuture, lang) {
931
+ return lang.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
932
+ }
933
+
934
+ function relativeTime(milliseconds, withoutSuffix, lang) {
935
+ var seconds = round(Math.abs(milliseconds) / 1000),
936
+ minutes = round(seconds / 60),
937
+ hours = round(minutes / 60),
938
+ days = round(hours / 24),
939
+ years = round(days / 365),
940
+ args = seconds < 45 && ['s', seconds] ||
941
+ minutes === 1 && ['m'] ||
942
+ minutes < 45 && ['mm', minutes] ||
943
+ hours === 1 && ['h'] ||
944
+ hours < 22 && ['hh', hours] ||
945
+ days === 1 && ['d'] ||
946
+ days <= 25 && ['dd', days] ||
947
+ days <= 45 && ['M'] ||
948
+ days < 345 && ['MM', round(days / 30)] ||
949
+ years === 1 && ['y'] || ['yy', years];
950
+ args[2] = withoutSuffix;
951
+ args[3] = milliseconds > 0;
952
+ args[4] = lang;
953
+ return substituteTimeAgo.apply({}, args);
954
+ }
955
+
956
+
957
+ /************************************
958
+ Week of Year
959
+ ************************************/
960
+
961
+
962
+ // firstDayOfWeek 0 = sun, 6 = sat
963
+ // the day of the week that starts the week
964
+ // (usually sunday or monday)
965
+ // firstDayOfWeekOfYear 0 = sun, 6 = sat
966
+ // the first week is the week that contains the first
967
+ // of this day of the week
968
+ // (eg. ISO weeks use thursday (4))
969
+ function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
970
+ var end = firstDayOfWeekOfYear - firstDayOfWeek,
971
+ daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
972
+ adjustedMoment;
973
+
974
+
975
+ if (daysToDayOfWeek > end) {
976
+ daysToDayOfWeek -= 7;
977
+ }
978
+
979
+ if (daysToDayOfWeek < end - 7) {
980
+ daysToDayOfWeek += 7;
981
+ }
982
+
983
+ adjustedMoment = moment(mom).add('d', daysToDayOfWeek);
984
+ return {
985
+ week: Math.ceil(adjustedMoment.dayOfYear() / 7),
986
+ year: adjustedMoment.year()
987
+ };
988
+ }
989
+
990
+
991
+ /************************************
992
+ Top Level Functions
993
+ ************************************/
994
+
995
+ function makeMoment(config) {
996
+ var input = config._i,
997
+ format = config._f;
998
+
999
+ if (input === null || input === '') {
1000
+ return null;
1001
+ }
1002
+
1003
+ if (typeof input === 'string') {
1004
+ config._i = input = getLangDefinition().preparse(input);
1005
+ }
1006
+
1007
+ if (moment.isMoment(input)) {
1008
+ config = extend({}, input);
1009
+ config._d = new Date(+input._d);
1010
+ } else if (format) {
1011
+ if (isArray(format)) {
1012
+ makeDateFromStringAndArray(config);
1013
+ } else {
1014
+ makeDateFromStringAndFormat(config);
1015
+ }
1016
+ } else {
1017
+ makeDateFromInput(config);
1018
+ }
1019
+
1020
+ return new Moment(config);
1021
+ }
1022
+
1023
+ moment = function (input, format, lang) {
1024
+ return makeMoment({
1025
+ _i : input,
1026
+ _f : format,
1027
+ _l : lang,
1028
+ _isUTC : false
1029
+ });
1030
+ };
1031
+
1032
+ // creating with utc
1033
+ moment.utc = function (input, format, lang) {
1034
+ return makeMoment({
1035
+ _useUTC : true,
1036
+ _isUTC : true,
1037
+ _l : lang,
1038
+ _i : input,
1039
+ _f : format
1040
+ });
1041
+ };
1042
+
1043
+ // creating with unix timestamp (in seconds)
1044
+ moment.unix = function (input) {
1045
+ return moment(input * 1000);
1046
+ };
1047
+
1048
+ // duration
1049
+ moment.duration = function (input, key) {
1050
+ var isDuration = moment.isDuration(input),
1051
+ isNumber = (typeof input === 'number'),
1052
+ duration = (isDuration ? input._input : (isNumber ? {} : input)),
1053
+ matched = aspNetTimeSpanJsonRegex.exec(input),
1054
+ sign,
1055
+ ret;
1056
+
1057
+ if (isNumber) {
1058
+ if (key) {
1059
+ duration[key] = input;
1060
+ } else {
1061
+ duration.milliseconds = input;
1062
+ }
1063
+ } else if (matched) {
1064
+ sign = (matched[1] === "-") ? -1 : 1;
1065
+ duration = {
1066
+ y: 0,
1067
+ d: ~~matched[2] * sign,
1068
+ h: ~~matched[3] * sign,
1069
+ m: ~~matched[4] * sign,
1070
+ s: ~~matched[5] * sign,
1071
+ ms: ~~matched[6] * sign
1072
+ };
1073
+ }
1074
+
1075
+ ret = new Duration(duration);
1076
+
1077
+ if (isDuration && input.hasOwnProperty('_lang')) {
1078
+ ret._lang = input._lang;
1079
+ }
1080
+
1081
+ return ret;
1082
+ };
1083
+
1084
+ // version number
1085
+ moment.version = VERSION;
1086
+
1087
+ // default format
1088
+ moment.defaultFormat = isoFormat;
1089
+
1090
+ // This function will be called whenever a moment is mutated.
1091
+ // It is intended to keep the offset in sync with the timezone.
1092
+ moment.updateOffset = function () {};
1093
+
1094
+ // This function will load languages and then set the global language. If
1095
+ // no arguments are passed in, it will simply return the current global
1096
+ // language key.
1097
+ moment.lang = function (key, values) {
1098
+ if (!key) {
1099
+ return moment.fn._lang._abbr;
1100
+ }
1101
+ if (values) {
1102
+ loadLang(key, values);
1103
+ } else if (!languages[key]) {
1104
+ getLangDefinition(key);
1105
+ }
1106
+ moment.duration.fn._lang = moment.fn._lang = getLangDefinition(key);
1107
+ };
1108
+
1109
+ // returns language data
1110
+ moment.langData = function (key) {
1111
+ if (key && key._lang && key._lang._abbr) {
1112
+ key = key._lang._abbr;
1113
+ }
1114
+ return getLangDefinition(key);
1115
+ };
1116
+
1117
+ // compare moment object
1118
+ moment.isMoment = function (obj) {
1119
+ return obj instanceof Moment;
1120
+ };
1121
+
1122
+ // for typechecking Duration objects
1123
+ moment.isDuration = function (obj) {
1124
+ return obj instanceof Duration;
1125
+ };
1126
+
1127
+
1128
+ /************************************
1129
+ Moment Prototype
1130
+ ************************************/
1131
+
1132
+
1133
+ moment.fn = Moment.prototype = {
1134
+
1135
+ clone : function () {
1136
+ return moment(this);
1137
+ },
1138
+
1139
+ valueOf : function () {
1140
+ return +this._d + ((this._offset || 0) * 60000);
1141
+ },
1142
+
1143
+ unix : function () {
1144
+ return Math.floor(+this / 1000);
1145
+ },
1146
+
1147
+ toString : function () {
1148
+ return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
1149
+ },
1150
+
1151
+ toDate : function () {
1152
+ return this._offset ? new Date(+this) : this._d;
1153
+ },
1154
+
1155
+ toISOString : function () {
1156
+ return formatMoment(moment(this).utc(), 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
1157
+ },
1158
+
1159
+ toArray : function () {
1160
+ var m = this;
1161
+ return [
1162
+ m.year(),
1163
+ m.month(),
1164
+ m.date(),
1165
+ m.hours(),
1166
+ m.minutes(),
1167
+ m.seconds(),
1168
+ m.milliseconds()
1169
+ ];
1170
+ },
1171
+
1172
+ isValid : function () {
1173
+ if (this._isValid == null) {
1174
+ if (this._a) {
1175
+ this._isValid = !compareArrays(this._a, (this._isUTC ? moment.utc(this._a) : moment(this._a)).toArray());
1176
+ } else {
1177
+ this._isValid = !isNaN(this._d.getTime());
1178
+ }
1179
+ }
1180
+ return !!this._isValid;
1181
+ },
1182
+
1183
+ utc : function () {
1184
+ return this.zone(0);
1185
+ },
1186
+
1187
+ local : function () {
1188
+ this.zone(0);
1189
+ this._isUTC = false;
1190
+ return this;
1191
+ },
1192
+
1193
+ format : function (inputString) {
1194
+ var output = formatMoment(this, inputString || moment.defaultFormat);
1195
+ return this.lang().postformat(output);
1196
+ },
1197
+
1198
+ add : function (input, val) {
1199
+ var dur;
1200
+ // switch args to support add('s', 1) and add(1, 's')
1201
+ if (typeof input === 'string') {
1202
+ dur = moment.duration(+val, input);
1203
+ } else {
1204
+ dur = moment.duration(input, val);
1205
+ }
1206
+ addOrSubtractDurationFromMoment(this, dur, 1);
1207
+ return this;
1208
+ },
1209
+
1210
+ subtract : function (input, val) {
1211
+ var dur;
1212
+ // switch args to support subtract('s', 1) and subtract(1, 's')
1213
+ if (typeof input === 'string') {
1214
+ dur = moment.duration(+val, input);
1215
+ } else {
1216
+ dur = moment.duration(input, val);
1217
+ }
1218
+ addOrSubtractDurationFromMoment(this, dur, -1);
1219
+ return this;
1220
+ },
1221
+
1222
+ diff : function (input, units, asFloat) {
1223
+ var that = this._isUTC ? moment(input).zone(this._offset || 0) : moment(input).local(),
1224
+ zoneDiff = (this.zone() - that.zone()) * 6e4,
1225
+ diff, output;
1226
+
1227
+ units = normalizeUnits(units);
1228
+
1229
+ if (units === 'year' || units === 'month') {
1230
+ // average number of days in the months in the given dates
1231
+ diff = (this.daysInMonth() + that.daysInMonth()) * 432e5; // 24 * 60 * 60 * 1000 / 2
1232
+ // difference in months
1233
+ output = ((this.year() - that.year()) * 12) + (this.month() - that.month());
1234
+ // adjust by taking difference in days, average number of days
1235
+ // and dst in the given months.
1236
+ output += ((this - moment(this).startOf('month')) -
1237
+ (that - moment(that).startOf('month'))) / diff;
1238
+ // same as above but with zones, to negate all dst
1239
+ output -= ((this.zone() - moment(this).startOf('month').zone()) -
1240
+ (that.zone() - moment(that).startOf('month').zone())) * 6e4 / diff;
1241
+ if (units === 'year') {
1242
+ output = output / 12;
1243
+ }
1244
+ } else {
1245
+ diff = (this - that);
1246
+ output = units === 'second' ? diff / 1e3 : // 1000
1247
+ units === 'minute' ? diff / 6e4 : // 1000 * 60
1248
+ units === 'hour' ? diff / 36e5 : // 1000 * 60 * 60
1249
+ units === 'day' ? (diff - zoneDiff) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
1250
+ units === 'week' ? (diff - zoneDiff) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
1251
+ diff;
1252
+ }
1253
+ return asFloat ? output : absRound(output);
1254
+ },
1255
+
1256
+ from : function (time, withoutSuffix) {
1257
+ return moment.duration(this.diff(time)).lang(this.lang()._abbr).humanize(!withoutSuffix);
1258
+ },
1259
+
1260
+ fromNow : function (withoutSuffix) {
1261
+ return this.from(moment(), withoutSuffix);
1262
+ },
1263
+
1264
+ calendar : function () {
1265
+ var diff = this.diff(moment().startOf('day'), 'days', true),
1266
+ format = diff < -6 ? 'sameElse' :
1267
+ diff < -1 ? 'lastWeek' :
1268
+ diff < 0 ? 'lastDay' :
1269
+ diff < 1 ? 'sameDay' :
1270
+ diff < 2 ? 'nextDay' :
1271
+ diff < 7 ? 'nextWeek' : 'sameElse';
1272
+ return this.format(this.lang().calendar(format, this));
1273
+ },
1274
+
1275
+ isLeapYear : function () {
1276
+ var year = this.year();
1277
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
1278
+ },
1279
+
1280
+ isDST : function () {
1281
+ return (this.zone() < this.clone().month(0).zone() ||
1282
+ this.zone() < this.clone().month(5).zone());
1283
+ },
1284
+
1285
+ day : function (input) {
1286
+ var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
1287
+ if (input != null) {
1288
+ if (typeof input === 'string') {
1289
+ input = this.lang().weekdaysParse(input);
1290
+ if (typeof input !== 'number') {
1291
+ return this;
1292
+ }
1293
+ }
1294
+ return this.add({ d : input - day });
1295
+ } else {
1296
+ return day;
1297
+ }
1298
+ },
1299
+
1300
+ month : function (input) {
1301
+ var utc = this._isUTC ? 'UTC' : '',
1302
+ dayOfMonth,
1303
+ daysInMonth;
1304
+
1305
+ if (input != null) {
1306
+ if (typeof input === 'string') {
1307
+ input = this.lang().monthsParse(input);
1308
+ if (typeof input !== 'number') {
1309
+ return this;
1310
+ }
1311
+ }
1312
+
1313
+ dayOfMonth = this.date();
1314
+ this.date(1);
1315
+ this._d['set' + utc + 'Month'](input);
1316
+ this.date(Math.min(dayOfMonth, this.daysInMonth()));
1317
+
1318
+ moment.updateOffset(this);
1319
+ return this;
1320
+ } else {
1321
+ return this._d['get' + utc + 'Month']();
1322
+ }
1323
+ },
1324
+
1325
+ startOf: function (units) {
1326
+ units = normalizeUnits(units);
1327
+ // the following switch intentionally omits break keywords
1328
+ // to utilize falling through the cases.
1329
+ switch (units) {
1330
+ case 'year':
1331
+ this.month(0);
1332
+ /* falls through */
1333
+ case 'month':
1334
+ this.date(1);
1335
+ /* falls through */
1336
+ case 'week':
1337
+ case 'day':
1338
+ this.hours(0);
1339
+ /* falls through */
1340
+ case 'hour':
1341
+ this.minutes(0);
1342
+ /* falls through */
1343
+ case 'minute':
1344
+ this.seconds(0);
1345
+ /* falls through */
1346
+ case 'second':
1347
+ this.milliseconds(0);
1348
+ /* falls through */
1349
+ }
1350
+
1351
+ // weeks are a special case
1352
+ if (units === 'week') {
1353
+ this.weekday(0);
1354
+ }
1355
+
1356
+ return this;
1357
+ },
1358
+
1359
+ endOf: function (units) {
1360
+ return this.startOf(units).add(units, 1).subtract('ms', 1);
1361
+ },
1362
+
1363
+ isAfter: function (input, units) {
1364
+ units = typeof units !== 'undefined' ? units : 'millisecond';
1365
+ return +this.clone().startOf(units) > +moment(input).startOf(units);
1366
+ },
1367
+
1368
+ isBefore: function (input, units) {
1369
+ units = typeof units !== 'undefined' ? units : 'millisecond';
1370
+ return +this.clone().startOf(units) < +moment(input).startOf(units);
1371
+ },
1372
+
1373
+ isSame: function (input, units) {
1374
+ units = typeof units !== 'undefined' ? units : 'millisecond';
1375
+ return +this.clone().startOf(units) === +moment(input).startOf(units);
1376
+ },
1377
+
1378
+ min: function (other) {
1379
+ other = moment.apply(null, arguments);
1380
+ return other < this ? this : other;
1381
+ },
1382
+
1383
+ max: function (other) {
1384
+ other = moment.apply(null, arguments);
1385
+ return other > this ? this : other;
1386
+ },
1387
+
1388
+ zone : function (input) {
1389
+ var offset = this._offset || 0;
1390
+ if (input != null) {
1391
+ if (typeof input === "string") {
1392
+ input = timezoneMinutesFromString(input);
1393
+ }
1394
+ if (Math.abs(input) < 16) {
1395
+ input = input * 60;
1396
+ }
1397
+ this._offset = input;
1398
+ this._isUTC = true;
1399
+ if (offset !== input) {
1400
+ addOrSubtractDurationFromMoment(this, moment.duration(offset - input, 'm'), 1, true);
1401
+ }
1402
+ } else {
1403
+ return this._isUTC ? offset : this._d.getTimezoneOffset();
1404
+ }
1405
+ return this;
1406
+ },
1407
+
1408
+ zoneAbbr : function () {
1409
+ return this._isUTC ? "UTC" : "";
1410
+ },
1411
+
1412
+ zoneName : function () {
1413
+ return this._isUTC ? "Coordinated Universal Time" : "";
1414
+ },
1415
+
1416
+ daysInMonth : function () {
1417
+ return moment.utc([this.year(), this.month() + 1, 0]).date();
1418
+ },
1419
+
1420
+ dayOfYear : function (input) {
1421
+ var dayOfYear = round((moment(this).startOf('day') - moment(this).startOf('year')) / 864e5) + 1;
1422
+ return input == null ? dayOfYear : this.add("d", (input - dayOfYear));
1423
+ },
1424
+
1425
+ weekYear : function (input) {
1426
+ var year = weekOfYear(this, this.lang()._week.dow, this.lang()._week.doy).year;
1427
+ return input == null ? year : this.add("y", (input - year));
1428
+ },
1429
+
1430
+ isoWeekYear : function (input) {
1431
+ var year = weekOfYear(this, 1, 4).year;
1432
+ return input == null ? year : this.add("y", (input - year));
1433
+ },
1434
+
1435
+ week : function (input) {
1436
+ var week = this.lang().week(this);
1437
+ return input == null ? week : this.add("d", (input - week) * 7);
1438
+ },
1439
+
1440
+ isoWeek : function (input) {
1441
+ var week = weekOfYear(this, 1, 4).week;
1442
+ return input == null ? week : this.add("d", (input - week) * 7);
1443
+ },
1444
+
1445
+ weekday : function (input) {
1446
+ var weekday = (this._d.getDay() + 7 - this.lang()._week.dow) % 7;
1447
+ return input == null ? weekday : this.add("d", input - weekday);
1448
+ },
1449
+
1450
+ isoWeekday : function (input) {
1451
+ // behaves the same as moment#day except
1452
+ // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
1453
+ // as a setter, sunday should belong to the previous week.
1454
+ return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
1455
+ },
1456
+
1457
+ // If passed a language key, it will set the language for this
1458
+ // instance. Otherwise, it will return the language configuration
1459
+ // variables for this instance.
1460
+ lang : function (key) {
1461
+ if (key === undefined) {
1462
+ return this._lang;
1463
+ } else {
1464
+ this._lang = getLangDefinition(key);
1465
+ return this;
1466
+ }
1467
+ }
1468
+ };
1469
+
1470
+ // helper for adding shortcuts
1471
+ function makeGetterAndSetter(name, key) {
1472
+ moment.fn[name] = moment.fn[name + 's'] = function (input) {
1473
+ var utc = this._isUTC ? 'UTC' : '';
1474
+ if (input != null) {
1475
+ this._d['set' + utc + key](input);
1476
+ moment.updateOffset(this);
1477
+ return this;
1478
+ } else {
1479
+ return this._d['get' + utc + key]();
1480
+ }
1481
+ };
1482
+ }
1483
+
1484
+ // loop through and add shortcuts (Month, Date, Hours, Minutes, Seconds, Milliseconds)
1485
+ for (i = 0; i < proxyGettersAndSetters.length; i ++) {
1486
+ makeGetterAndSetter(proxyGettersAndSetters[i].toLowerCase().replace(/s$/, ''), proxyGettersAndSetters[i]);
1487
+ }
1488
+
1489
+ // add shortcut for year (uses different syntax than the getter/setter 'year' == 'FullYear')
1490
+ makeGetterAndSetter('year', 'FullYear');
1491
+
1492
+ // add plural methods
1493
+ moment.fn.days = moment.fn.day;
1494
+ moment.fn.months = moment.fn.month;
1495
+ moment.fn.weeks = moment.fn.week;
1496
+ moment.fn.isoWeeks = moment.fn.isoWeek;
1497
+
1498
+ // add aliased format methods
1499
+ moment.fn.toJSON = moment.fn.toISOString;
1500
+
1501
+ /************************************
1502
+ Duration Prototype
1503
+ ************************************/
1504
+
1505
+
1506
+ moment.duration.fn = Duration.prototype = {
1507
+ _bubble : function () {
1508
+ var milliseconds = this._milliseconds,
1509
+ days = this._days,
1510
+ months = this._months,
1511
+ data = this._data,
1512
+ seconds, minutes, hours, years;
1513
+
1514
+ // The following code bubbles up values, see the tests for
1515
+ // examples of what that means.
1516
+ data.milliseconds = milliseconds % 1000;
1517
+
1518
+ seconds = absRound(milliseconds / 1000);
1519
+ data.seconds = seconds % 60;
1520
+
1521
+ minutes = absRound(seconds / 60);
1522
+ data.minutes = minutes % 60;
1523
+
1524
+ hours = absRound(minutes / 60);
1525
+ data.hours = hours % 24;
1526
+
1527
+ days += absRound(hours / 24);
1528
+ data.days = days % 30;
1529
+
1530
+ months += absRound(days / 30);
1531
+ data.months = months % 12;
1532
+
1533
+ years = absRound(months / 12);
1534
+ data.years = years;
1535
+ },
1536
+
1537
+ weeks : function () {
1538
+ return absRound(this.days() / 7);
1539
+ },
1540
+
1541
+ valueOf : function () {
1542
+ return this._milliseconds +
1543
+ this._days * 864e5 +
1544
+ (this._months % 12) * 2592e6 +
1545
+ ~~(this._months / 12) * 31536e6;
1546
+ },
1547
+
1548
+ humanize : function (withSuffix) {
1549
+ var difference = +this,
1550
+ output = relativeTime(difference, !withSuffix, this.lang());
1551
+
1552
+ if (withSuffix) {
1553
+ output = this.lang().pastFuture(difference, output);
1554
+ }
1555
+
1556
+ return this.lang().postformat(output);
1557
+ },
1558
+
1559
+ add : function (input, val) {
1560
+ // supports only 2.0-style add(1, 's') or add(moment)
1561
+ var dur = moment.duration(input, val);
1562
+
1563
+ this._milliseconds += dur._milliseconds;
1564
+ this._days += dur._days;
1565
+ this._months += dur._months;
1566
+
1567
+ this._bubble();
1568
+
1569
+ return this;
1570
+ },
1571
+
1572
+ subtract : function (input, val) {
1573
+ var dur = moment.duration(input, val);
1574
+
1575
+ this._milliseconds -= dur._milliseconds;
1576
+ this._days -= dur._days;
1577
+ this._months -= dur._months;
1578
+
1579
+ this._bubble();
1580
+
1581
+ return this;
1582
+ },
1583
+
1584
+ get : function (units) {
1585
+ units = normalizeUnits(units);
1586
+ return this[units.toLowerCase() + 's']();
1587
+ },
1588
+
1589
+ as : function (units) {
1590
+ units = normalizeUnits(units);
1591
+ return this['as' + units.charAt(0).toUpperCase() + units.slice(1) + 's']();
1592
+ },
1593
+
1594
+ lang : moment.fn.lang
1595
+ };
1596
+
1597
+ function makeDurationGetter(name) {
1598
+ moment.duration.fn[name] = function () {
1599
+ return this._data[name];
1600
+ };
1601
+ }
1602
+
1603
+ function makeDurationAsGetter(name, factor) {
1604
+ moment.duration.fn['as' + name] = function () {
1605
+ return +this / factor;
1606
+ };
1607
+ }
1608
+
1609
+ for (i in unitMillisecondFactors) {
1610
+ if (unitMillisecondFactors.hasOwnProperty(i)) {
1611
+ makeDurationAsGetter(i, unitMillisecondFactors[i]);
1612
+ makeDurationGetter(i.toLowerCase());
1613
+ }
1614
+ }
1615
+
1616
+ makeDurationAsGetter('Weeks', 6048e5);
1617
+ moment.duration.fn.asMonths = function () {
1618
+ return (+this - this.years() * 31536e6) / 2592e6 + this.years() * 12;
1619
+ };
1620
+
1621
+
1622
+ /************************************
1623
+ Default Lang
1624
+ ************************************/
1625
+
1626
+
1627
+ // Set default language, other languages will inherit from English.
1628
+ moment.lang('en', {
1629
+ ordinal : function (number) {
1630
+ var b = number % 10,
1631
+ output = (~~ (number % 100 / 10) === 1) ? 'th' :
1632
+ (b === 1) ? 'st' :
1633
+ (b === 2) ? 'nd' :
1634
+ (b === 3) ? 'rd' : 'th';
1635
+ return number + output;
1636
+ }
1637
+ });
1638
+
1639
+
1640
+ /************************************
1641
+ Exposing Moment
1642
+ ************************************/
1643
+
1644
+
1645
+ // CommonJS module is defined
1646
+ if (hasModule) {
1647
+ module.exports = moment;
1648
+ }
1649
+ /*global ender:false */
1650
+ if (typeof ender === 'undefined') {
1651
+ // here, `this` means `window` in the browser, or `global` on the server
1652
+ // add `moment` as a global object via a string identifier,
1653
+ // for Closure Compiler "advanced" mode
1654
+ this['moment'] = moment;
1655
+ }
1656
+ /*global define:false */
1657
+ if (typeof define === "function" && define.amd) {
1658
+ define("moment", [], function () {
1659
+ return moment;
1660
+ });
1661
+ }
1662
+ }).call(this);