chrono-node 1.3.5 → 1.4.4

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 (195) hide show
  1. package/.travis.yml +2 -0
  2. package/README.md +100 -86
  3. package/dist/chrono.js +7865 -0
  4. package/dist/chrono.js.map +1 -0
  5. package/dist/chrono.min.js +3 -0
  6. package/dist/chrono.min.js.LICENSE.txt +19 -0
  7. package/dist/chrono.min.js.map +1 -0
  8. package/package.json +20 -22
  9. package/src/chrono.js +5 -3
  10. package/src/options.js +33 -3
  11. package/src/parsers/{DE → de}/DECasualDateParser.js +18 -21
  12. package/src/parsers/{DE → de}/DEDeadlineFormatParser.js +9 -9
  13. package/src/parsers/{DE → de}/DEMonthNameLittleEndianParser.js +15 -36
  14. package/src/parsers/{DE → de}/DEMonthNameParser.js +12 -27
  15. package/src/parsers/{DE → de}/DESlashDateFormatParser.js +2 -3
  16. package/src/parsers/{DE → de}/DETimeAgoFormatParser.js +9 -14
  17. package/src/parsers/{DE → de}/DETimeExpressionParser.js +2 -2
  18. package/src/parsers/{DE → de}/DEWeekdayParser.js +14 -14
  19. package/src/parsers/{EN → en}/ENCasualDateParser.js +6 -11
  20. package/src/parsers/en/ENCasualTimeParser.js +54 -0
  21. package/src/parsers/{EN → en}/ENDeadlineFormatParser.js +15 -20
  22. package/src/parsers/{EN → en}/ENISOFormatParser.js +3 -3
  23. package/src/parsers/{EN → en}/ENMonthNameLittleEndianParser.js +25 -49
  24. package/src/parsers/{EN → en}/ENMonthNameMiddleEndianParser.js +6 -23
  25. package/src/parsers/{EN → en}/ENMonthNameParser.js +5 -22
  26. package/src/parsers/{EN → en}/ENRelativeDateFormatParser.js +48 -15
  27. package/src/parsers/{EN → en}/ENSlashDateFormatParser.js +7 -3
  28. package/src/parsers/{EN → en}/ENSlashDateFormatStartWithYearParser.js +12 -5
  29. package/src/parsers/{EN → en}/ENSlashMonthFormatParser.js +2 -5
  30. package/src/parsers/en/ENTimeAgoFormatParser.js +69 -0
  31. package/src/parsers/{EN → en}/ENTimeExpressionParser.js +26 -17
  32. package/src/parsers/en/ENTimeLaterFormatParser.js +75 -0
  33. package/src/parsers/{EN → en}/ENWeekdayParser.js +8 -12
  34. package/src/parsers/{ES → es}/ESCasualDateParser.js +8 -13
  35. package/src/parsers/{ES → es}/ESDeadlineFormatParser.js +5 -11
  36. package/src/parsers/{ES → es}/ESMonthNameLittleEndianParser.js +6 -28
  37. package/src/parsers/{ES → es}/ESSlashDateFormatParser.js +2 -2
  38. package/src/parsers/{ES → es}/ESTimeAgoFormatParser.js +8 -13
  39. package/src/parsers/{ES → es}/ESTimeExpressionParser.js +2 -7
  40. package/src/parsers/{ES → es}/ESWeekdayParser.js +1 -6
  41. package/src/parsers/{FR → fr}/FRCasualDateParser.js +6 -11
  42. package/src/parsers/{FR → fr}/FRDeadlineFormatParser.js +9 -14
  43. package/src/parsers/{FR → fr}/FRMonthNameLittleEndianParser.js +4 -26
  44. package/src/parsers/{FR → fr}/FRRelativeDateFormatParser.js +29 -34
  45. package/src/parsers/{FR → fr}/FRSlashDateFormatParser.js +22 -15
  46. package/src/parsers/{FR → fr}/FRTimeAgoFormatParser.js +8 -14
  47. package/src/parsers/{FR → fr}/FRTimeExpressionParser.js +2 -7
  48. package/src/parsers/{FR → fr}/FRWeekdayParser.js +1 -6
  49. package/src/parsers/{JP → ja}/JPCasualDateParser.js +5 -10
  50. package/src/parsers/ja/JPStandardParser.js +71 -0
  51. package/src/parsers/parser.js +80 -53
  52. package/src/parsers/pt/PTCasualDateParser.js +123 -0
  53. package/src/parsers/pt/PTDeadlineFormatParser.js +61 -0
  54. package/src/parsers/pt/PTMonthNameLittleEndianParser.js +86 -0
  55. package/src/parsers/pt/PTSlashDateFormatParser.js +114 -0
  56. package/src/parsers/pt/PTTimeAgoFormatParser.js +87 -0
  57. package/src/parsers/pt/PTTimeExpressionParser.js +234 -0
  58. package/src/parsers/pt/PTWeekdayParser.js +60 -0
  59. package/src/parsers/{ZH-Hant → zh-Hant}/ZHHantCasualDateParser.js +30 -19
  60. package/src/parsers/{ZH-Hant → zh-Hant}/ZHHantDateParser.js +2 -7
  61. package/src/parsers/{ZH-Hant → zh-Hant}/ZHHantDeadlineFormatParser.js +14 -19
  62. package/src/parsers/{ZH-Hant → zh-Hant}/ZHHantTimeExpressionParser.js +38 -11
  63. package/src/parsers/{ZH-Hant → zh-Hant}/ZHHantWeekdayParser.js +1 -7
  64. package/src/refiners/ExtractTimezoneAbbrRefiner.js +19 -10
  65. package/src/refiners/ForwardDateRefiner.js +10 -15
  66. package/src/refiners/{DE → de}/DEMergeDateRangeRefiner.js +1 -1
  67. package/src/refiners/{DE → de}/DEMergeDateTimeRefiner.js +3 -3
  68. package/src/refiners/{EN → en}/ENMergeDateRangeRefiner.js +5 -9
  69. package/src/refiners/{EN → en}/ENMergeDateTimeRefiner.js +15 -2
  70. package/src/refiners/{EN → en}/ENMergeWeekdayRefiner.js +0 -0
  71. package/src/refiners/{EN → en}/ENPrioritizeSpecificDateRefiner.js +0 -0
  72. package/src/refiners/{FR → fr}/FRMergeDateRangeRefiner.js +0 -0
  73. package/src/refiners/{FR → fr}/FRMergeDateTimeRefiner.js +1 -1
  74. package/src/refiners/{JP → ja}/JPMergeDateRangeRefiner.js +1 -1
  75. package/src/refiners/refiner.js +12 -12
  76. package/src/result.js +47 -19
  77. package/src/timezone.js +2 -0
  78. package/src/utils/EN.js +68 -2
  79. package/src/utils/PT.js +62 -0
  80. package/test/de/de.test.js +51 -0
  81. package/test/de/de_casual.test.js +432 -0
  82. package/test/de/de_dash.test.js +6 -0
  83. package/test/de/de_deadline.test.js +244 -0
  84. package/test/de/de_little_endian.test.js +459 -0
  85. package/test/de/de_time_ago.test.js +313 -0
  86. package/test/de/de_time_exp.test.js +166 -0
  87. package/test/de/de_weekday.test.js +235 -0
  88. package/test/en/en.test.js +250 -0
  89. package/test/en/en_casual.test.js +461 -0
  90. package/test/en/en_dash.test.js +31 -0
  91. package/test/en/en_deadline.test.js +366 -0
  92. package/test/{test_example.js → en/en_example.test.js} +7 -18
  93. package/test/en/en_inter_std.test.js +269 -0
  94. package/test/en/en_little_endian.test.js +566 -0
  95. package/test/en/en_middle_endian.test.js +552 -0
  96. package/test/en/en_month.test.js +156 -0
  97. package/test/en/en_option_forward.test.js +156 -0
  98. package/test/en/en_relative.test.js +228 -0
  99. package/test/en/en_slash.test.js +450 -0
  100. package/test/en/en_time_ago.test.js +374 -0
  101. package/test/en/en_time_exp.test.js +722 -0
  102. package/test/en/en_time_from_now.test.js +371 -0
  103. package/test/en/en_time_later.test.js +95 -0
  104. package/test/en/en_weekday.test.js +301 -0
  105. package/test/es/es_casual.test.js +258 -0
  106. package/test/es/es_dash.test.js +13 -0
  107. package/test/es/es_deadline.test.js +85 -0
  108. package/test/es/es_little_endian.test.js +350 -0
  109. package/test/es/es_slash.test.js +24 -0
  110. package/test/es/es_time_ago.test.js +137 -0
  111. package/test/es/es_time_exp.test.js +240 -0
  112. package/test/fr/fr_casual.test.js +454 -0
  113. package/test/fr/fr_dash.test.js +26 -0
  114. package/test/fr/fr_deadline.test.js +244 -0
  115. package/test/fr/fr_little_endian.test.js +576 -0
  116. package/test/fr/fr_relative.test.js +198 -0
  117. package/test/fr/fr_slash.test.js +81 -0
  118. package/test/fr/fr_time_ago.test.js +194 -0
  119. package/test/fr/fr_time_exp.test.js +960 -0
  120. package/test/fr/fr_weekday.test.js +200 -0
  121. package/test/ja/ja_casual.test.js +51 -0
  122. package/test/ja/ja_standard.test.js +344 -0
  123. package/test/pt/pt_casual.test.js +258 -0
  124. package/test/pt/pt_dash.test.js +13 -0
  125. package/test/pt/pt_deadline.test.js +85 -0
  126. package/test/pt/pt_little_endian.test.js +350 -0
  127. package/test/pt/pt_slash.test.js +44 -0
  128. package/test/pt/pt_time_ago.test.js +137 -0
  129. package/test/pt/pt_time_exp.test.js +240 -0
  130. package/test/system.test.js +207 -0
  131. package/test/zh/zh_hant_casual.test.js +340 -0
  132. package/test/zh/zh_hant_date.test.js +118 -0
  133. package/test/zh/zh_hant_deadline.test.js +213 -0
  134. package/test/zh/zh_hant_time_exp.test.js +226 -0
  135. package/test/zh/zh_hant_weekday.test.js +160 -0
  136. package/webpack.config.js +39 -0
  137. package/.npmignore +0 -11
  138. package/bower.json +0 -24
  139. package/chrono.js +0 -11892
  140. package/chrono.map.json +0 -1
  141. package/chrono.min.js +0 -148
  142. package/chrono.min.json +0 -1
  143. package/karma.conf.js +0 -68
  144. package/src/parsers/EN/ENCasualTimeParser.js +0 -53
  145. package/src/parsers/EN/ENTimeAgoFormatParser.js +0 -130
  146. package/src/parsers/EN/ENTimeFromNowFormatParser.js +0 -119
  147. package/src/parsers/JP/JPStandardParser.js +0 -88
  148. package/test/test_de.js +0 -62
  149. package/test/test_de_casual.js +0 -443
  150. package/test/test_de_dash.js +0 -17
  151. package/test/test_de_deadline.js +0 -255
  152. package/test/test_de_little_endian.js +0 -470
  153. package/test/test_de_time_ago.js +0 -324
  154. package/test/test_de_time_exp.js +0 -177
  155. package/test/test_de_weekday.js +0 -246
  156. package/test/test_en.js +0 -249
  157. package/test/test_en_casual.js +0 -448
  158. package/test/test_en_dash.js +0 -42
  159. package/test/test_en_deadline.js +0 -311
  160. package/test/test_en_inter_std.js +0 -272
  161. package/test/test_en_little_endian.js +0 -529
  162. package/test/test_en_middle_endian.js +0 -563
  163. package/test/test_en_month.js +0 -124
  164. package/test/test_en_option_forward.js +0 -167
  165. package/test/test_en_relative.js +0 -206
  166. package/test/test_en_slash.js +0 -370
  167. package/test/test_en_time_ago.js +0 -385
  168. package/test/test_en_time_exp.js +0 -663
  169. package/test/test_en_time_from_now.js +0 -345
  170. package/test/test_en_weekday.js +0 -312
  171. package/test/test_es_casual.js +0 -269
  172. package/test/test_es_dash.js +0 -24
  173. package/test/test_es_deadline.js +0 -96
  174. package/test/test_es_little_endian.js +0 -361
  175. package/test/test_es_slash.js +0 -35
  176. package/test/test_es_time_ago.js +0 -148
  177. package/test/test_es_time_exp.js +0 -251
  178. package/test/test_fr_casual.js +0 -465
  179. package/test/test_fr_dash.js +0 -37
  180. package/test/test_fr_deadline.js +0 -255
  181. package/test/test_fr_little_endian.js +0 -568
  182. package/test/test_fr_relative.js +0 -209
  183. package/test/test_fr_slash.js +0 -54
  184. package/test/test_fr_time_ago.js +0 -205
  185. package/test/test_fr_time_exp.js +0 -971
  186. package/test/test_fr_weekday.js +0 -211
  187. package/test/test_jp_casual.js +0 -62
  188. package/test/test_jp_standard.js +0 -181
  189. package/test/test_system.js +0 -178
  190. package/test/test_zh_hant_casual.js +0 -329
  191. package/test/test_zh_hant_date.js +0 -129
  192. package/test/test_zh_hant_deadline.js +0 -224
  193. package/test/test_zh_hant_time_exp.js +0 -210
  194. package/test/test_zh_hant_weekday.js +0 -171
  195. package/timezone.js +0 -9
package/chrono.min.json DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.js","sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","node_modules/moment/moment.js","src/chrono.js","src/options.js","src/parsers/EN/SlashParser.js","src/parsers/parser.js","src/refiners/EN/MergeDateRangeRefiner.js","src/refiners/refiner.js","src/result.js"],"names":[],"mappings":"AAAA;ACAA;AACA;AACA;AACA;;ACHA;;ACAA;;ACAA;;ACAA;;ACAA;;ACAA;;ACAA","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","(function (global){\n(function(e){function t(e,t,n){switch(arguments.length){case 2:return null!=e?e:t;case 3:return null!=e?e:null!=t?t:n;default:throw new Error(\"Implement me\")}}function n(e,t){return bt.call(e,t)}function s(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function a(e){Mt.suppressDeprecationWarnings===!1&&\"undefined\"!=typeof console&&console.warn&&console.warn(\"Deprecation warning: \"+e)}function i(e,t){var n=!0;return h(function(){return n&&(a(e),n=!1),t.apply(this,arguments)},t)}function r(e,t){pn[e]||(a(t),pn[e]=!0)}function o(e,t){return function(n){return m(e.call(this,n),t)}}function u(e,t){return function(n){return this.localeData().ordinal(e.call(this,n),t)}}function c(){}function l(e,t){t!==!1&&U(e),f(this,e),this._d=new Date(+e._d)}function d(e){var t=k(e),n=t.year||0,s=t.quarter||0,a=t.month||0,i=t.week||0,r=t.day||0,o=t.hour||0,u=t.minute||0,c=t.second||0,l=t.millisecond||0;this._milliseconds=+l+1e3*c+6e4*u+36e5*o,this._days=+r+7*i,this._months=+a+3*s+12*n,this._data={},this._locale=Mt.localeData(),this._bubble()}function h(e,t){for(var s in t)n(t,s)&&(e[s]=t[s]);return n(t,\"toString\")&&(e.toString=t.toString),n(t,\"valueOf\")&&(e.valueOf=t.valueOf),e}function f(e,t){var n,s,a;if(\"undefined\"!=typeof t._isAMomentObject&&(e._isAMomentObject=t._isAMomentObject),\"undefined\"!=typeof t._i&&(e._i=t._i),\"undefined\"!=typeof t._f&&(e._f=t._f),\"undefined\"!=typeof t._l&&(e._l=t._l),\"undefined\"!=typeof t._strict&&(e._strict=t._strict),\"undefined\"!=typeof t._tzm&&(e._tzm=t._tzm),\"undefined\"!=typeof t._isUTC&&(e._isUTC=t._isUTC),\"undefined\"!=typeof t._offset&&(e._offset=t._offset),\"undefined\"!=typeof t._pf&&(e._pf=t._pf),\"undefined\"!=typeof t._locale&&(e._locale=t._locale),Pt.length>0)for(n in Pt)s=Pt[n],a=t[s],\"undefined\"!=typeof a&&(e[s]=a);return e}function _(e){return 0>e?Math.ceil(e):Math.floor(e)}function m(e,t,n){for(var s=\"\"+Math.abs(e),a=e>=0;s.length<t;)s=\"0\"+s;return(a?n?\"+\":\"\":\"-\")+s}function y(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,\"M\").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,\"M\"),n}function p(e,t){var n;return t=I(t,e),e.isBefore(t)?n=y(e,t):(n=y(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n}function g(e,t){return function(n,s){var a,i;return null===s||isNaN(+s)||(r(t,\"moment().\"+t+\"(period, number) is deprecated. Please use moment().\"+t+\"(number, period).\"),i=n,n=s,s=i),n=\"string\"==typeof n?+n:n,a=Mt.duration(n,s),M(this,a,e),this}}function M(e,t,n,s){var a=t._milliseconds,i=t._days,r=t._months;s=null==s?!0:s,a&&e._d.setTime(+e._d+a*n),i&&ft(e,\"Date\",ht(e,\"Date\")+i*n),r&&dt(e,ht(e,\"Month\")+r*n),s&&Mt.updateOffset(e,i||r)}function D(e){return\"[object Array]\"===Object.prototype.toString.call(e)}function Y(e){return\"[object Date]\"===Object.prototype.toString.call(e)||e instanceof Date}function w(e,t,n){var s,a=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),r=0;for(s=0;a>s;s++)(n&&e[s]!==t[s]||!n&&S(e[s])!==S(t[s]))&&r++;return r+i}function v(e){if(e){var t=e.toLowerCase().replace(/(.)s$/,\"$1\");e=ln[e]||dn[t]||t}return e}function k(e){var t,s,a={};for(s in e)n(e,s)&&(t=v(s),t&&(a[t]=e[s]));return a}function b(t){var n,s;if(0===t.indexOf(\"week\"))n=7,s=\"day\";else{if(0!==t.indexOf(\"month\"))return;n=12,s=\"month\"}Mt[t]=function(a,i){var r,o,u=Mt._locale[t],c=[];if(\"number\"==typeof a&&(i=a,a=e),o=function(e){var t=Mt().utc().set(s,e);return u.call(Mt._locale,t,a||\"\")},null!=i)return o(i);for(r=0;n>r;r++)c.push(o(r));return c}}function S(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=t>=0?Math.floor(t):Math.ceil(t)),n}function T(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function O(e,t,n){return ot(Mt([e,11,31+t-n]),t,n).week}function W(e){return G(e)?366:365}function G(e){return 0===e%4&&0!==e%100||0===e%400}function U(e){var t;e._a&&-2===e._pf.overflow&&(t=e._a[Tt]<0||e._a[Tt]>11?Tt:e._a[Ot]<1||e._a[Ot]>T(e._a[St],e._a[Tt])?Ot:e._a[Wt]<0||e._a[Wt]>24||24===e._a[Wt]&&(0!==e._a[Gt]||0!==e._a[Ut]||0!==e._a[Ct])?Wt:e._a[Gt]<0||e._a[Gt]>59?Gt:e._a[Ut]<0||e._a[Ut]>59?Ut:e._a[Ct]<0||e._a[Ct]>999?Ct:-1,e._pf._overflowDayOfYear&&(St>t||t>Ot)&&(t=Ot),e._pf.overflow=t)}function C(t){return null==t._isValid&&(t._isValid=!isNaN(t._d.getTime())&&t._pf.overflow<0&&!t._pf.empty&&!t._pf.invalidMonth&&!t._pf.nullInput&&!t._pf.invalidFormat&&!t._pf.userInvalidated,t._strict&&(t._isValid=t._isValid&&0===t._pf.charsLeftOver&&0===t._pf.unusedTokens.length&&t._pf.bigHour===e)),t._isValid}function F(e){return e?e.toLowerCase().replace(\"_\",\"-\"):e}function P(e){for(var t,n,s,a,i=0;i<e.length;){for(a=F(e[i]).split(\"-\"),t=a.length,n=F(e[i+1]),n=n?n.split(\"-\"):null;t>0;){if(s=z(a.slice(0,t).join(\"-\")))return s;if(n&&n.length>=t&&w(a,n,!0)>=t-1)break;t--}i++}return null}function z(e){var t=null;if(!Ft[e]&&zt)try{t=Mt.locale(),require(\"./locale/\"+e),Mt.locale(t)}catch(n){}return Ft[e]}function I(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(Mt.isMoment(e)||Y(e)?+e:+Mt(e))-+n,n._d.setTime(+n._d+s),Mt.updateOffset(n,!1),n):Mt(e).local()}function L(e){return e.match(/\\[[\\s\\S]/)?e.replace(/^\\[|\\]$/g,\"\"):e.replace(/\\\\/g,\"\")}function x(e){var t,n,s=e.match(Ht);for(t=0,n=s.length;n>t;t++)s[t]=yn[s[t]]?yn[s[t]]:L(s[t]);return function(a){var i=\"\";for(t=0;n>t;t++)i+=s[t]instanceof Function?s[t].call(a,e):s[t];return i}}function H(e,t){return e.isValid()?(t=A(t,e.localeData()),hn[t]||(hn[t]=x(t)),hn[t](e)):e.localeData().invalidDate()}function A(e,t){function n(e){return t.longDateFormat(e)||e}var s=5;for(At.lastIndex=0;s>=0&&At.test(e);)e=e.replace(At,n),At.lastIndex=0,s-=1;return e}function Z(e,t){var n,s=t._strict;switch(e){case\"Q\":return Xt;case\"DDDD\":return Kt;case\"YYYY\":case\"GGGG\":case\"gggg\":return s?en:jt;case\"Y\":case\"G\":case\"g\":return nn;case\"YYYYYY\":case\"YYYYY\":case\"GGGGG\":case\"ggggg\":return s?tn:Nt;case\"S\":if(s)return Xt;case\"SS\":if(s)return Bt;case\"SSS\":if(s)return Kt;case\"DDD\":return Et;case\"MMM\":case\"MMMM\":case\"dd\":case\"ddd\":case\"dddd\":return $t;case\"a\":case\"A\":return t._locale._meridiemParse;case\"x\":return Rt;case\"X\":return Qt;case\"Z\":case\"ZZ\":return qt;case\"T\":return Jt;case\"SSSS\":return Vt;case\"MM\":case\"DD\":case\"YY\":case\"GG\":case\"gg\":case\"HH\":case\"hh\":case\"mm\":case\"ss\":case\"ww\":case\"WW\":return s?Bt:Zt;case\"M\":case\"D\":case\"d\":case\"H\":case\"h\":case\"m\":case\"s\":case\"w\":case\"W\":case\"e\":case\"E\":return Zt;case\"Do\":return s?t._locale._ordinalParse:t._locale._ordinalParseLenient;default:return n=new RegExp(Q(R(e.replace(\"\\\\\",\"\")),\"i\"))}}function E(e){e=e||\"\";var t=e.match(qt)||[],n=t[t.length-1]||[],s=(n+\"\").match(un)||[\"-\",0,0],a=+(60*s[1])+S(s[2]);return\"+\"===s[0]?-a:a}function j(e,t,n){var s,a=n._a;switch(e){case\"Q\":null!=t&&(a[Tt]=3*(S(t)-1));break;case\"M\":case\"MM\":null!=t&&(a[Tt]=S(t)-1);break;case\"MMM\":case\"MMMM\":s=n._locale.monthsParse(t,e,n._strict),null!=s?a[Tt]=s:n._pf.invalidMonth=t;break;case\"D\":case\"DD\":null!=t&&(a[Ot]=S(t));break;case\"Do\":null!=t&&(a[Ot]=S(parseInt(t.match(/\\d{1,2}/)[0],10)));break;case\"DDD\":case\"DDDD\":null!=t&&(n._dayOfYear=S(t));break;case\"YY\":a[St]=Mt.parseTwoDigitYear(t);break;case\"YYYY\":case\"YYYYY\":case\"YYYYYY\":a[St]=S(t);break;case\"a\":case\"A\":n._isPm=n._locale.isPM(t);break;case\"h\":case\"hh\":n._pf.bigHour=!0;case\"H\":case\"HH\":a[Wt]=S(t);break;case\"m\":case\"mm\":a[Gt]=S(t);break;case\"s\":case\"ss\":a[Ut]=S(t);break;case\"S\":case\"SS\":case\"SSS\":case\"SSSS\":a[Ct]=S(1e3*(\"0.\"+t));break;case\"x\":n._d=new Date(S(t));break;case\"X\":n._d=new Date(1e3*parseFloat(t));break;case\"Z\":case\"ZZ\":n._useUTC=!0,n._tzm=E(t);break;case\"dd\":case\"ddd\":case\"dddd\":s=n._locale.weekdaysParse(t),null!=s?(n._w=n._w||{},n._w.d=s):n._pf.invalidWeekday=t;break;case\"w\":case\"ww\":case\"W\":case\"WW\":case\"d\":case\"e\":case\"E\":e=e.substr(0,1);case\"gggg\":case\"GGGG\":case\"GGGGG\":e=e.substr(0,2),t&&(n._w=n._w||{},n._w[e]=S(t));break;case\"gg\":case\"GG\":n._w=n._w||{},n._w[e]=Mt.parseTwoDigitYear(t)}}function N(e){var n,s,a,i,r,o,u;n=e._w,null!=n.GG||null!=n.W||null!=n.E?(r=1,o=4,s=t(n.GG,e._a[St],ot(Mt(),1,4).year),a=t(n.W,1),i=t(n.E,1)):(r=e._locale._week.dow,o=e._locale._week.doy,s=t(n.gg,e._a[St],ot(Mt(),r,o).year),a=t(n.w,1),null!=n.d?(i=n.d,r>i&&++a):i=null!=n.e?n.e+r:r),u=ut(s,a,i,o,r),e._a[St]=u.year,e._dayOfYear=u.dayOfYear}function V(e){var n,s,a,i,r=[];if(!e._d){for(a=q(e),e._w&&null==e._a[Ot]&&null==e._a[Tt]&&N(e),e._dayOfYear&&(i=t(e._a[St],a[St]),e._dayOfYear>W(i)&&(e._pf._overflowDayOfYear=!0),s=st(i,0,e._dayOfYear),e._a[Tt]=s.getUTCMonth(),e._a[Ot]=s.getUTCDate()),n=0;3>n&&null==e._a[n];++n)e._a[n]=r[n]=a[n];for(;7>n;n++)e._a[n]=r[n]=null==e._a[n]?2===n?1:0:e._a[n];24===e._a[Wt]&&0===e._a[Gt]&&0===e._a[Ut]&&0===e._a[Ct]&&(e._nextDay=!0,e._a[Wt]=0),e._d=(e._useUTC?st:nt).apply(null,r),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()+e._tzm),e._nextDay&&(e._a[Wt]=24)}}function $(e){var t;e._d||(t=k(e._i),e._a=[t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],V(e))}function q(e){var t=new Date;return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function J(t){if(t._f===Mt.ISO_8601)return B(t),void 0;t._a=[],t._pf.empty=!0;var n,s,a,i,r,o=\"\"+t._i,u=o.length,c=0;for(a=A(t._f,t._locale).match(Ht)||[],n=0;n<a.length;n++)i=a[n],s=(o.match(Z(i,t))||[])[0],s&&(r=o.substr(0,o.indexOf(s)),r.length>0&&t._pf.unusedInput.push(r),o=o.slice(o.indexOf(s)+s.length),c+=s.length),yn[i]?(s?t._pf.empty=!1:t._pf.unusedTokens.push(i),j(i,s,t)):t._strict&&!s&&t._pf.unusedTokens.push(i);t._pf.charsLeftOver=u-c,o.length>0&&t._pf.unusedInput.push(o),t._pf.bigHour===!0&&t._a[Wt]<=12&&(t._pf.bigHour=e),t._isPm&&t._a[Wt]<12&&(t._a[Wt]+=12),t._isPm===!1&&12===t._a[Wt]&&(t._a[Wt]=0),V(t),U(t)}function R(e){return e.replace(/\\\\(\\[)|\\\\(\\])|\\[([^\\]\\[]*)\\]|\\\\(.)/g,function(e,t,n,s,a){return t||n||s||a})}function Q(e){return e.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g,\"\\\\$&\")}function X(e){var t,n,a,i,r;if(0===e._f.length)return e._pf.invalidFormat=!0,e._d=new Date(0/0),void 0;for(i=0;i<e._f.length;i++)r=0,t=f({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._pf=s(),t._f=e._f[i],J(t),C(t)&&(r+=t._pf.charsLeftOver,r+=10*t._pf.unusedTokens.length,t._pf.score=r,(null==a||a>r)&&(a=r,n=t));h(e,n||t)}function B(e){var t,n,s=e._i,a=sn.exec(s);if(a){for(e._pf.iso=!0,t=0,n=rn.length;n>t;t++)if(rn[t][1].exec(s)){e._f=rn[t][0]+(a[6]||\" \");break}for(t=0,n=on.length;n>t;t++)if(on[t][1].exec(s)){e._f+=on[t][0];break}s.match(qt)&&(e._f+=\"Z\"),J(e)}else e._isValid=!1}function K(e){B(e),e._isValid===!1&&(delete e._isValid,Mt.createFromInputFallback(e))}function et(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function tt(t){var n,s=t._i;s===e?t._d=new Date:Y(s)?t._d=new Date(+s):null!==(n=It.exec(s))?t._d=new Date(+n[1]):\"string\"==typeof s?K(t):D(s)?(t._a=et(s.slice(0),function(e){return parseInt(e,10)}),V(t)):\"object\"==typeof s?$(t):\"number\"==typeof s?t._d=new Date(s):Mt.createFromInputFallback(t)}function nt(e,t,n,s,a,i,r){var o=new Date(e,t,n,s,a,i,r);return 1970>e&&o.setFullYear(e),o}function st(e){var t=new Date(Date.UTC.apply(null,arguments));return 1970>e&&t.setUTCFullYear(e),t}function at(e,t){if(\"string\"==typeof e)if(isNaN(e)){if(e=t.weekdaysParse(e),\"number\"!=typeof e)return null}else e=parseInt(e,10);return e}function it(e,t,n,s,a){return a.relativeTime(t||1,!!n,e,s)}function rt(e,t,n){var s=Mt.duration(e).abs(),a=kt(s.as(\"s\")),i=kt(s.as(\"m\")),r=kt(s.as(\"h\")),o=kt(s.as(\"d\")),u=kt(s.as(\"M\")),c=kt(s.as(\"y\")),l=a<fn.s&&[\"s\",a]||1===i&&[\"m\"]||i<fn.m&&[\"mm\",i]||1===r&&[\"h\"]||r<fn.h&&[\"hh\",r]||1===o&&[\"d\"]||o<fn.d&&[\"dd\",o]||1===u&&[\"M\"]||u<fn.M&&[\"MM\",u]||1===c&&[\"y\"]||[\"yy\",c];return l[2]=t,l[3]=+e>0,l[4]=n,it.apply({},l)}function ot(e,t,n){var s,a=n-t,i=n-e.day();return i>a&&(i-=7),a-7>i&&(i+=7),s=Mt(e).add(i,\"d\"),{week:Math.ceil(s.dayOfYear()/7),year:s.year()}}function ut(e,t,n,s,a){var i,r,o=st(e,0,1).getUTCDay();return o=0===o?7:o,n=null!=n?n:a,i=a-o+(o>s?7:0)-(a>o?7:0),r=7*(t-1)+(n-a)+i+1,{year:r>0?e:e-1,dayOfYear:r>0?r:W(e-1)+r}}function ct(t){var n,s=t._i,a=t._f;return t._locale=t._locale||Mt.localeData(t._l),null===s||a===e&&\"\"===s?Mt.invalid({nullInput:!0}):(\"string\"==typeof s&&(t._i=s=t._locale.preparse(s)),Mt.isMoment(s)?new l(s,!0):(a?D(a)?X(t):J(t):tt(t),n=new l(t),n._nextDay&&(n.add(1,\"d\"),n._nextDay=e),n))}function lt(e,t){var n,s;if(1===t.length&&D(t[0])&&(t=t[0]),!t.length)return Mt();for(n=t[0],s=1;s<t.length;++s)t[s][e](n)&&(n=t[s]);return n}function dt(e,t){var n;return\"string\"==typeof t&&(t=e.localeData().monthsParse(t),\"number\"!=typeof t)?e:(n=Math.min(e.date(),T(e.year(),t)),e._d[\"set\"+(e._isUTC?\"UTC\":\"\")+\"Month\"](t,n),e)}function ht(e,t){return e._d[\"get\"+(e._isUTC?\"UTC\":\"\")+t]()}function ft(e,t,n){return\"Month\"===t?dt(e,n):e._d[\"set\"+(e._isUTC?\"UTC\":\"\")+t](n)}function _t(e,t){return function(n){return null!=n?(ft(this,e,n),Mt.updateOffset(this,t),this):ht(this,e)}}function mt(e){return 400*e/146097}function yt(e){return 146097*e/400}function pt(e){Mt.duration.fn[e]=function(){return this._data[e]}}function gt(e){\"undefined\"==typeof ender&&(Dt=vt.moment,vt.moment=e?i(\"Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.\",Mt):Mt)}for(var Mt,Dt,Yt,wt=\"2.8.4\",vt=\"undefined\"!=typeof global?global:this,kt=Math.round,bt=Object.prototype.hasOwnProperty,St=0,Tt=1,Ot=2,Wt=3,Gt=4,Ut=5,Ct=6,Ft={},Pt=[],zt=\"undefined\"!=typeof module&&module&&module.exports,It=/^\\/?Date\\((\\-?\\d+)/i,Lt=/(\\-)?(?:(\\d*)\\.)?(\\d+)\\:(\\d+)(?:\\:(\\d+)\\.?(\\d{3})?)?/,xt=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Ht=/(\\[[^\\[]*\\])|(\\\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,At=/(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Zt=/\\d\\d?/,Et=/\\d{1,3}/,jt=/\\d{1,4}/,Nt=/[+\\-]?\\d{1,6}/,Vt=/\\d+/,$t=/[0-9]*['a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+|[\\u0600-\\u06FF\\/]+(\\s*?[\\u0600-\\u06FF]+){1,2}/i,qt=/Z|[\\+\\-]\\d\\d:?\\d\\d/gi,Jt=/T/i,Rt=/[\\+\\-]?\\d+/,Qt=/[\\+\\-]?\\d+(\\.\\d{1,3})?/,Xt=/\\d/,Bt=/\\d\\d/,Kt=/\\d{3}/,en=/\\d{4}/,tn=/[+-]?\\d{6}/,nn=/[+-]?\\d+/,sn=/^\\s*(?:[+-]\\d{6}|\\d{4})-(?:(\\d\\d-\\d\\d)|(W\\d\\d$)|(W\\d\\d-\\d)|(\\d\\d\\d))((T| )(\\d\\d(:\\d\\d(:\\d\\d(\\.\\d+)?)?)?)?([\\+\\-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,an=\"YYYY-MM-DDTHH:mm:ssZ\",rn=[[\"YYYYYY-MM-DD\",/[+-]\\d{6}-\\d{2}-\\d{2}/],[\"YYYY-MM-DD\",/\\d{4}-\\d{2}-\\d{2}/],[\"GGGG-[W]WW-E\",/\\d{4}-W\\d{2}-\\d/],[\"GGGG-[W]WW\",/\\d{4}-W\\d{2}/],[\"YYYY-DDD\",/\\d{4}-\\d{3}/]],on=[[\"HH:mm:ss.SSSS\",/(T| )\\d\\d:\\d\\d:\\d\\d\\.\\d+/],[\"HH:mm:ss\",/(T| )\\d\\d:\\d\\d:\\d\\d/],[\"HH:mm\",/(T| )\\d\\d:\\d\\d/],[\"HH\",/(T| )\\d\\d/]],un=/([\\+\\-]|\\d\\d)/gi,cn=(\"Date|Hours|Minutes|Seconds|Milliseconds\".split(\"|\"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),ln={ms:\"millisecond\",s:\"second\",m:\"minute\",h:\"hour\",d:\"day\",D:\"date\",w:\"week\",W:\"isoWeek\",M:\"month\",Q:\"quarter\",y:\"year\",DDD:\"dayOfYear\",e:\"weekday\",E:\"isoWeekday\",gg:\"weekYear\",GG:\"isoWeekYear\"},dn={dayofyear:\"dayOfYear\",isoweekday:\"isoWeekday\",isoweek:\"isoWeek\",weekyear:\"weekYear\",isoweekyear:\"isoWeekYear\"},hn={},fn={s:45,m:45,h:22,d:26,M:11},_n=\"DDD w W M D d\".split(\" \"),mn=\"M D H h m s w W\".split(\" \"),yn={M:function(){return this.month()+1},MMM:function(e){return this.localeData().monthsShort(this,e)},MMMM:function(e){return this.localeData().months(this,e)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(e){return this.localeData().weekdaysMin(this,e)},ddd:function(e){return this.localeData().weekdaysShort(this,e)},dddd:function(e){return this.localeData().weekdays(this,e)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return m(this.year()%100,2)},YYYY:function(){return m(this.year(),4)},YYYYY:function(){return m(this.year(),5)},YYYYYY:function(){var e=this.year(),t=e>=0?\"+\":\"-\";return t+m(Math.abs(e),6)},gg:function(){return m(this.weekYear()%100,2)},gggg:function(){return m(this.weekYear(),4)},ggggg:function(){return m(this.weekYear(),5)},GG:function(){return m(this.isoWeekYear()%100,2)},GGGG:function(){return m(this.isoWeekYear(),4)},GGGGG:function(){return m(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return S(this.milliseconds()/100)},SS:function(){return m(S(this.milliseconds()/10),2)},SSS:function(){return m(this.milliseconds(),3)},SSSS:function(){return m(this.milliseconds(),3)},Z:function(){var e=-this.zone(),t=\"+\";return 0>e&&(e=-e,t=\"-\"),t+m(S(e/60),2)+\":\"+m(S(e)%60,2)},ZZ:function(){var e=-this.zone(),t=\"+\";return 0>e&&(e=-e,t=\"-\"),t+m(S(e/60),2)+m(S(e)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},x:function(){return this.valueOf()},X:function(){return this.unix()},Q:function(){return this.quarter()}},pn={},gn=[\"months\",\"monthsShort\",\"weekdays\",\"weekdaysShort\",\"weekdaysMin\"];_n.length;)Yt=_n.pop(),yn[Yt+\"o\"]=u(yn[Yt],Yt);for(;mn.length;)Yt=mn.pop(),yn[Yt+Yt]=o(yn[Yt],2);yn.DDDD=o(yn.DDD,3),h(c.prototype,{set:function(e){var t,n;for(n in e)t=e[n],\"function\"==typeof t?this[n]=t:this[\"_\"+n]=t;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+\"|\"+/\\d{1,2}/.source)},_months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),months:function(e){return this._months[e.month()]},_monthsShort:\"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec\".split(\"_\"),monthsShort:function(e){return this._monthsShort[e.month()]},monthsParse:function(e,t,n){var s,a,i;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;12>s;s++){if(a=Mt.utc([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp(\"^\"+this.months(a,\"\").replace(\".\",\"\")+\"$\",\"i\"),this._shortMonthsParse[s]=new RegExp(\"^\"+this.monthsShort(a,\"\").replace(\".\",\"\")+\"$\",\"i\")),n||this._monthsParse[s]||(i=\"^\"+this.months(a,\"\")+\"|^\"+this.monthsShort(a,\"\"),this._monthsParse[s]=new RegExp(i.replace(\".\",\"\"),\"i\")),n&&\"MMMM\"===t&&this._longMonthsParse[s].test(e))return s;if(n&&\"MMM\"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},_weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),weekdays:function(e){return this._weekdays[e.day()]},_weekdaysShort:\"Sun_Mon_Tue_Wed_Thu_Fri_Sat\".split(\"_\"),weekdaysShort:function(e){return this._weekdaysShort[e.day()]},_weekdaysMin:\"Su_Mo_Tu_We_Th_Fr_Sa\".split(\"_\"),weekdaysMin:function(e){return this._weekdaysMin[e.day()]},weekdaysParse:function(e){var t,n,s;for(this._weekdaysParse||(this._weekdaysParse=[]),t=0;7>t;t++)if(this._weekdaysParse[t]||(n=Mt([2e3,1]).day(t),s=\"^\"+this.weekdays(n,\"\")+\"|^\"+this.weekdaysShort(n,\"\")+\"|^\"+this.weekdaysMin(n,\"\"),this._weekdaysParse[t]=new RegExp(s.replace(\".\",\"\"),\"i\")),this._weekdaysParse[t].test(e))return t},_longDateFormat:{LTS:\"h:mm:ss A\",LT:\"h:mm A\",L:\"MM/DD/YYYY\",LL:\"MMMM D, YYYY\",LLL:\"MMMM D, YYYY LT\",LLLL:\"dddd, MMMM D, YYYY LT\"},longDateFormat:function(e){var t=this._longDateFormat[e];return!t&&this._longDateFormat[e.toUpperCase()]&&(t=this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e]=t),t},isPM:function(e){return\"p\"===(e+\"\").toLowerCase().charAt(0)},_meridiemParse:/[ap]\\.?m?\\.?/i,meridiem:function(e,t,n){return e>11?n?\"pm\":\"PM\":n?\"am\":\"AM\"},_calendar:{sameDay:\"[Today at] LT\",nextDay:\"[Tomorrow at] LT\",nextWeek:\"dddd [at] LT\",lastDay:\"[Yesterday at] LT\",lastWeek:\"[Last] dddd [at] LT\",sameElse:\"L\"},calendar:function(e,t,n){var s=this._calendar[e];return\"function\"==typeof s?s.apply(t,[n]):s},_relativeTime:{future:\"in %s\",past:\"%s ago\",s:\"a few seconds\",m:\"a minute\",mm:\"%d minutes\",h:\"an hour\",hh:\"%d hours\",d:\"a day\",dd:\"%d days\",M:\"a month\",MM:\"%d months\",y:\"a year\",yy:\"%d years\"},relativeTime:function(e,t,n,s){var a=this._relativeTime[n];return\"function\"==typeof a?a(e,t,n,s):a.replace(/%d/i,e)},pastFuture:function(e,t){var n=this._relativeTime[e>0?\"future\":\"past\"];return\"function\"==typeof n?n(t):n.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace(\"%d\",e)},_ordinal:\"%d\",_ordinalParse:/\\d{1,2}/,preparse:function(e){return e},postformat:function(e){return e},week:function(e){return ot(e,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:\"Invalid date\",invalidDate:function(){return this._invalidDate}}),Mt=function(t,n,a,i){var r;return\"boolean\"==typeof a&&(i=a,a=e),r={},r._isAMomentObject=!0,r._i=t,r._f=n,r._l=a,r._strict=i,r._isUTC=!1,r._pf=s(),ct(r)},Mt.suppressDeprecationWarnings=!1,Mt.createFromInputFallback=i(\"moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.\",function(e){e._d=new Date(e._i+(e._useUTC?\" UTC\":\"\"))}),Mt.min=function(){var e=[].slice.call(arguments,0);return lt(\"isBefore\",e)},Mt.max=function(){var e=[].slice.call(arguments,0);return lt(\"isAfter\",e)},Mt.utc=function(t,n,a,i){var r;return\"boolean\"==typeof a&&(i=a,a=e),r={},r._isAMomentObject=!0,r._useUTC=!0,r._isUTC=!0,r._l=a,r._i=t,r._f=n,r._strict=i,r._pf=s(),ct(r).utc()},Mt.unix=function(e){return Mt(1e3*e)},Mt.duration=function(e,t){var s,a,i,r,o=e,u=null;return Mt.isDuration(e)?o={ms:e._milliseconds,d:e._days,M:e._months}:\"number\"==typeof e?(o={},t?o[t]=e:o.milliseconds=e):(u=Lt.exec(e))?(s=\"-\"===u[1]?-1:1,o={y:0,d:S(u[Ot])*s,h:S(u[Wt])*s,m:S(u[Gt])*s,s:S(u[Ut])*s,ms:S(u[Ct])*s}):(u=xt.exec(e))?(s=\"-\"===u[1]?-1:1,i=function(e){var t=e&&parseFloat(e.replace(\",\",\".\"));return(isNaN(t)?0:t)*s},o={y:i(u[2]),M:i(u[3]),d:i(u[4]),h:i(u[5]),m:i(u[6]),s:i(u[7]),w:i(u[8])}):\"object\"==typeof o&&(\"from\"in o||\"to\"in o)&&(r=p(Mt(o.from),Mt(o.to)),o={},o.ms=r.milliseconds,o.M=r.months),a=new d(o),Mt.isDuration(e)&&n(e,\"_locale\")&&(a._locale=e._locale),a},Mt.version=wt,Mt.defaultFormat=an,Mt.ISO_8601=function(){},Mt.momentProperties=Pt,Mt.updateOffset=function(){},Mt.relativeTimeThreshold=function(t,n){return fn[t]===e?!1:n===e?fn[t]:(fn[t]=n,!0)},Mt.lang=i(\"moment.lang is deprecated. Use moment.locale instead.\",function(e,t){return Mt.locale(e,t)}),Mt.locale=function(e,t){var n;return e&&(n=\"undefined\"!=typeof t?Mt.defineLocale(e,t):Mt.localeData(e),n&&(Mt.duration._locale=Mt._locale=n)),Mt._locale._abbr},Mt.defineLocale=function(e,t){return null!==t?(t.abbr=e,Ft[e]||(Ft[e]=new c),Ft[e].set(t),Mt.locale(e),Ft[e]):(delete Ft[e],null)},Mt.langData=i(\"moment.langData is deprecated. Use moment.localeData instead.\",function(e){return Mt.localeData(e)}),Mt.localeData=function(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Mt._locale;if(!D(e)){if(t=z(e))return t;e=[e]}return P(e)},Mt.isMoment=function(e){return e instanceof l||null!=e&&n(e,\"_isAMomentObject\")},Mt.isDuration=function(e){return e instanceof d};for(Yt=gn.length-1;Yt>=0;--Yt)b(gn[Yt]);Mt.normalizeUnits=function(e){return v(e)},Mt.invalid=function(e){var t=Mt.utc(0/0);return null!=e?h(t._pf,e):t._pf.userInvalidated=!0,t},Mt.parseZone=function(){return Mt.apply(null,arguments).parseZone()},Mt.parseTwoDigitYear=function(e){return S(e)+(S(e)>68?1900:2e3)},h(Mt.fn=l.prototype,{clone:function(){return Mt(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale(\"en\").format(\"ddd MMM DD YYYY HH:mm:ss [GMT]ZZ\")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var e=Mt(this).utc();return 0<e.year()&&e.year()<=9999?\"function\"==typeof Date.prototype.toISOString?this.toDate().toISOString():H(e,\"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]\"):H(e,\"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]\")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return C(this)},isDSTShifted:function(){return this._a?this.isValid()&&w(this._a,(this._isUTC?Mt.utc(this._a):Mt(this._a)).toArray())>0:!1},parsingFlags:function(){return h({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(e){return this.zone(0,e)},local:function(e){return this._isUTC&&(this.zone(0,e),this._isUTC=!1,e&&this.add(this._dateTzOffset(),\"m\")),this},format:function(e){var t=H(this,e||Mt.defaultFormat);return this.localeData().postformat(t)},add:g(1,\"add\"),subtract:g(-1,\"subtract\"),diff:function(e,t,n){var s,a,i,r=I(e,this),o=6e4*(this.zone()-r.zone());return t=v(t),\"year\"===t||\"month\"===t?(s=432e5*(this.daysInMonth()+r.daysInMonth()),a=12*(this.year()-r.year())+(this.month()-r.month()),i=this-Mt(this).startOf(\"month\")-(r-Mt(r).startOf(\"month\")),i-=6e4*(this.zone()-Mt(this).startOf(\"month\").zone()-(r.zone()-Mt(r).startOf(\"month\").zone())),a+=i/s,\"year\"===t&&(a/=12)):(s=this-r,a=\"second\"===t?s/1e3:\"minute\"===t?s/6e4:\"hour\"===t?s/36e5:\"day\"===t?(s-o)/864e5:\"week\"===t?(s-o)/6048e5:s),n?a:_(a)},from:function(e,t){return Mt.duration({to:this,from:e}).locale(this.locale()).humanize(!t)},fromNow:function(e){return this.from(Mt(),e)},calendar:function(e){var t=e||Mt(),n=I(t,this).startOf(\"day\"),s=this.diff(n,\"days\",!0),a=-6>s?\"sameElse\":-1>s?\"lastWeek\":0>s?\"lastDay\":1>s?\"sameDay\":2>s?\"nextDay\":7>s?\"nextWeek\":\"sameElse\";return this.format(this.localeData().calendar(a,this,Mt(t)))},isLeapYear:function(){return G(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=at(e,this.localeData()),this.add(e-t,\"d\")):t},month:_t(\"Month\",!0),startOf:function(e){switch(e=v(e)){case\"year\":this.month(0);case\"quarter\":case\"month\":this.date(1);case\"week\":case\"isoWeek\":case\"day\":this.hours(0);case\"hour\":this.minutes(0);case\"minute\":this.seconds(0);case\"second\":this.milliseconds(0)}return\"week\"===e?this.weekday(0):\"isoWeek\"===e&&this.isoWeekday(1),\"quarter\"===e&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(t){return t=v(t),t===e||\"millisecond\"===t?this:this.startOf(t).add(1,\"isoWeek\"===t?\"week\":t).subtract(1,\"ms\")},isAfter:function(e,t){var n;return t=v(\"undefined\"!=typeof t?t:\"millisecond\"),\"millisecond\"===t?(e=Mt.isMoment(e)?e:Mt(e),+this>+e):(n=Mt.isMoment(e)?+e:+Mt(e),n<+this.clone().startOf(t))},isBefore:function(e,t){var n;return t=v(\"undefined\"!=typeof t?t:\"millisecond\"),\"millisecond\"===t?(e=Mt.isMoment(e)?e:Mt(e),+e>+this):(n=Mt.isMoment(e)?+e:+Mt(e),+this.clone().endOf(t)<n)},isSame:function(e,t){var n;return t=v(t||\"millisecond\"),\"millisecond\"===t?(e=Mt.isMoment(e)?e:Mt(e),+this===+e):(n=+Mt(e),+this.clone().startOf(t)<=n&&n<=+this.clone().endOf(t))},min:i(\"moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548\",function(e){return e=Mt.apply(null,arguments),this>e?this:e}),max:i(\"moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548\",function(e){return e=Mt.apply(null,arguments),e>this?this:e}),zone:function(e,t){var n,s=this._offset||0;return null==e?this._isUTC?s:this._dateTzOffset():(\"string\"==typeof e&&(e=E(e)),Math.abs(e)<16&&(e=60*e),!this._isUTC&&t&&(n=this._dateTzOffset()),this._offset=e,this._isUTC=!0,null!=n&&this.subtract(n,\"m\"),s!==e&&(!t||this._changeInProgress?M(this,Mt.duration(s-e,\"m\"),1,!1):this._changeInProgress||(this._changeInProgress=!0,Mt.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?\"UTC\":\"\"},zoneName:function(){return this._isUTC?\"Coordinated Universal Time\":\"\"},parseZone:function(){return this._tzm?this.zone(this._tzm):\"string\"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(e){return e=e?Mt(e).zone():0,0===(this.zone()-e)%60},daysInMonth:function(){return T(this.year(),this.month())},dayOfYear:function(e){var t=kt((Mt(this).startOf(\"day\")-Mt(this).startOf(\"year\"))/864e5)+1;return null==e?t:this.add(e-t,\"d\")},quarter:function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},weekYear:function(e){var t=ot(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==e?t:this.add(e-t,\"y\")},isoWeekYear:function(e){var t=ot(this,1,4).year;return null==e?t:this.add(e-t,\"y\")},week:function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),\"d\")},isoWeek:function(e){var t=ot(this,1,4).week;return null==e?t:this.add(7*(e-t),\"d\")},weekday:function(e){var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,\"d\")},isoWeekday:function(e){return null==e?this.day()||7:this.day(this.day()%7?e:e-7)},isoWeeksInYear:function(){return O(this.year(),1,4)},weeksInYear:function(){var e=this.localeData()._week;return O(this.year(),e.dow,e.doy)},get:function(e){return e=v(e),this[e]()},set:function(e,t){return e=v(e),\"function\"==typeof this[e]&&this[e](t),this},locale:function(t){var n;return t===e?this._locale._abbr:(n=Mt.localeData(t),null!=n&&(this._locale=n),this)},lang:i(\"moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.\",function(t){return t===e?this.localeData():this.locale(t)}),localeData:function(){return this._locale},_dateTzOffset:function(){return 15*Math.round(this._d.getTimezoneOffset()/15)}}),Mt.fn.millisecond=Mt.fn.milliseconds=_t(\"Milliseconds\",!1),Mt.fn.second=Mt.fn.seconds=_t(\"Seconds\",!1),Mt.fn.minute=Mt.fn.minutes=_t(\"Minutes\",!1),Mt.fn.hour=Mt.fn.hours=_t(\"Hours\",!0),Mt.fn.date=_t(\"Date\",!0),Mt.fn.dates=i(\"dates accessor is deprecated. Use date instead.\",_t(\"Date\",!0)),Mt.fn.year=_t(\"FullYear\",!0),Mt.fn.years=i(\"years accessor is deprecated. Use year instead.\",_t(\"FullYear\",!0)),Mt.fn.days=Mt.fn.day,Mt.fn.months=Mt.fn.month,Mt.fn.weeks=Mt.fn.week,Mt.fn.isoWeeks=Mt.fn.isoWeek,Mt.fn.quarters=Mt.fn.quarter,Mt.fn.toJSON=Mt.fn.toISOString,h(Mt.duration.fn=d.prototype,{_bubble:function(){var e,t,n,s=this._milliseconds,a=this._days,i=this._months,r=this._data,o=0;r.milliseconds=s%1e3,e=_(s/1e3),r.seconds=e%60,t=_(e/60),r.minutes=t%60,n=_(t/60),r.hours=n%24,a+=_(n/24),o=_(mt(a)),a-=_(yt(o)),i+=_(a/30),a%=30,o+=_(i/12),i%=12,r.days=a,r.months=i,r.years=o},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return _(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*(this._months%12)+31536e6*S(this._months/12)},humanize:function(e){var t=rt(this,!e,this.localeData());return e&&(t=this.localeData().pastFuture(+this,t)),this.localeData().postformat(t)},add:function(e,t){var n=Mt.duration(e,t);return this._milliseconds+=n._milliseconds,this._days+=n._days,this._months+=n._months,this._bubble(),this},subtract:function(e,t){var n=Mt.duration(e,t);return this._milliseconds-=n._milliseconds,this._days-=n._days,this._months-=n._months,this._bubble(),this},get:function(e){return e=v(e),this[e.toLowerCase()+\"s\"]()},as:function(e){var t,n;if(e=v(e),\"month\"===e||\"year\"===e)return t=this._days+this._milliseconds/864e5,n=this._months+12*mt(t),\"month\"===e?n:n/12;switch(t=this._days+Math.round(yt(this._months/12)),e){case\"week\":return t/7+this._milliseconds/6048e5;case\"day\":return t+this._milliseconds/864e5;case\"hour\":return 24*t+this._milliseconds/36e5;case\"minute\":return 60*24*t+this._milliseconds/6e4;case\"second\":return 60*60*24*t+this._milliseconds/1e3;\ncase\"millisecond\":return Math.floor(1e3*60*60*24*t)+this._milliseconds;default:throw new Error(\"Unknown unit \"+e)}},lang:Mt.fn.lang,locale:Mt.fn.locale,toIsoString:i(\"toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)\",function(){return this.toISOString()}),toISOString:function(){var e=Math.abs(this.years()),t=Math.abs(this.months()),n=Math.abs(this.days()),s=Math.abs(this.hours()),a=Math.abs(this.minutes()),i=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?\"-\":\"\")+\"P\"+(e?e+\"Y\":\"\")+(t?t+\"M\":\"\")+(n?n+\"D\":\"\")+(s||a||i?\"T\":\"\")+(s?s+\"H\":\"\")+(a?a+\"M\":\"\")+(i?i+\"S\":\"\"):\"P0D\"},localeData:function(){return this._locale}}),Mt.duration.fn.toString=Mt.duration.fn.toISOString;for(Yt in cn)n(cn,Yt)&&pt(Yt.toLowerCase());Mt.duration.fn.asMilliseconds=function(){return this.as(\"ms\")},Mt.duration.fn.asSeconds=function(){return this.as(\"s\")},Mt.duration.fn.asMinutes=function(){return this.as(\"m\")},Mt.duration.fn.asHours=function(){return this.as(\"h\")},Mt.duration.fn.asDays=function(){return this.as(\"d\")},Mt.duration.fn.asWeeks=function(){return this.as(\"weeks\")},Mt.duration.fn.asMonths=function(){return this.as(\"M\")},Mt.duration.fn.asYears=function(){return this.as(\"y\")},Mt.locale(\"en\",{ordinalParse:/\\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=1===S(e%100/10)?\"th\":1===t?\"st\":2===t?\"nd\":3===t?\"rd\":\"th\";return e+n}}),zt?module.exports=Mt:\"function\"==typeof define&&define.amd?(define(\"moment\",function(e,t,n){return n.config&&n.config()&&n.config().noGlobal===!0&&(vt.moment=Dt),Mt}),gt(!0)):gt()}).call(this);\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})","var Chrono=function(r){this.options=r,this.parsers=new Object(r.parsers),this.refiners=new Object(r.refiners)};Chrono.prototype.parse=function(r,e,s){e=e||new Date,s=s||{};var t=[];return this.parsers.forEach(function(n){var o=n.execute(r,e,s);t.concat(o)}),this.refiners.forEach(function(e){t=e.refine(r,t,s)}),t},Chrono.prototype.parseDate=function(r,e,s){var t=this.parse(r,e,s);return t>0?t[0].start.date():null},exports.Chrono=Chrono,exports.options=require(\"./options\"),exports.Parser=require(\"./parsers/parser\").Parser,exports.Refiner=require(\"./refiners/refiner\").Filter,exports.Filter=require(\"./refiners/refiner\").Filter,exports.ParsedResult=require(\"./result\").ParsedResult,exports.ParsedComponents=require(\"./result\").ParsedComponents,exports.standard=new Chrono(exports.options.standardOptions()),exports.parse=function(){exports.standard.parse.apply(exports.standard,arguments)},exports.parseDate=function(){exports.standard.parseDate.apply(exports.standard,arguments)};","var ENSlashDateFormatParser=require(\"./parsers/EN/SlashParser\").Parser,ENMergeDateRangeRefiner=require(\"./refiners/EN/MergeDateRangeRefiner\").Refiner;exports.standardOptions=function(){return{parsers:[new ENSlashDateFormatParser],refiners:[new ENMergeDateRangeRefiner]}};","function SlashParser(){}var Parser=require(\"../parser\").Parser;exports.Parser=SlashParser;","function Parser(){this.pattern=function(){return/./i},this.extract=function(){return null},this.execute=function(e,t,r){for(var n=[],i=this.pattern(),s=e,u=i.exec(s);u;){u.index+=e.length-s.length;var c=this.extract(e,t,u,r);s=c?e.substring(c.index+c.text.length):e.substring(u.index+1),u=i.exec(s)}return this.refiners&&this.refiners.forEach(function(){n=refiner.refine(n,e,options)}),n}}exports.Parser=Parser;","var Refiner=require(\"../refiner\").Refiner;exports.Refiner=function(){};","function Refiner(){}function Filter(){}Refiner.prototype.refine=function(){return/./i},Filter.prototype.isValid=function(){return!0},Filter.prototype.refine=function(e,r){for(var t=[],i=0;i=r.length;i++)this.isValid(r[i])&&t.push(r[i]);return t},exports.Refiner=Refiner,exports.Filter=Filter;","function ParsedResult(e){this.index=e.index,this.text=e.text,this.referenceDate=e.referenceDate,this.concordance=e.concordance,this.start=new DateComponents(e.start),e.end&&(this.end=new DateComponents(e.end))}function ParsedComponents(e){if(this.knownValues={},this.impliedValues={},e)for(key in e)this.knownValues[key]=e[key]}var moment=require(\"moment\");ParsedComponents.prototype.get=function(e){return e in this.knownValues?this.knownValues[e]:e in this.impliedValues?this.impliedValues[e]:void 0},ParsedComponents.prototype.assign=function(e,t){this.knownValues[e]=t,delete this.impliedValues[e]},ParsedComponents.prototype.imply=function(e,t){e in this.knownValues||(this.impliedValues[e]=t)},ParsedComponents.prototype.isCertain=function(e){return e in this.knownValues},ParsedComponents.prototype.date=function(e){this.isCertain(\"timezoneOffset\")&&(e=this.get(\"timezoneOffset\")),e=e||(new Date).getTimezoneOffset();var t=moment();return t.set(\"year\",this.get(\"year\")),t.set(\"month\",this.get(\"month\")-1),t.set(\"date\",this.get(\"day\")),void 0!==t.get(\"hour\")&&(t.set(\"hour\",this.get(\"hour\")),t.set(\"minute\",this.get(\"minute\")),t.set(\"second\",this.get(\"second\"))),t.add(e-(new Date).getTimezoneOffset(),\"minutes\"),t.toDate()},exports.ParsedComponents=ParsedComponents,exports.ParsedResult=ParsedResult;"]}
package/karma.conf.js DELETED
@@ -1,68 +0,0 @@
1
- // Karma configuration
2
- // Generated on Mon Oct 28 2013 19:53:46 GMT+0900 (JST)
3
-
4
- module.exports = function(config) {
5
- config.set({
6
-
7
- // base path, that will be used to resolve files and exclude
8
- basePath: '',
9
-
10
-
11
- // frameworks to use
12
- frameworks: ['qunit'],
13
-
14
- // list of files / patterns to load in the browser
15
- files: [
16
- 'chrono.js',
17
- 'test/test*.js',
18
- ],
19
-
20
-
21
- // list of files to exclude
22
- exclude: [
23
-
24
- ],
25
-
26
-
27
- // test results reporter to use
28
- // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
29
- reporters: ['progress'],
30
-
31
-
32
- // web server port
33
- port: 9876,
34
-
35
-
36
- // enable / disable colors in the output (reporters and logs)
37
- colors: true,
38
-
39
-
40
- // level of logging
41
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
42
- logLevel: config.LOG_INFO,
43
-
44
-
45
- // enable / disable watching file and executing tests whenever any file changes
46
- autoWatch: true,
47
-
48
-
49
- // Start these browsers, currently available:
50
- // - Chrome
51
- // - ChromeCanary
52
- // - Firefox
53
- // - Opera (has to be installed with `npm install karma-opera-launcher`)
54
- // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
55
- // - PhantomJS
56
- // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
57
- browsers: ['Chrome'],
58
-
59
-
60
- // If browser does not capture in given timeout [ms], kill it
61
- captureTimeout: 60000,
62
-
63
-
64
- // Continuous Integration mode
65
- // if true, it capture browsers, run tests and exit
66
- singleRun: false
67
- });
68
- };
@@ -1,53 +0,0 @@
1
- /*
2
-
3
-
4
- */
5
-
6
- var moment = require('moment');
7
- var Parser = require('../parser').Parser;
8
- var ParsedResult = require('../../result').ParsedResult;
9
-
10
- var PATTERN = /(\W|^)((this)?\s*(morning|afternoon|evening|noon))/i;
11
-
12
- var TIME_MATCH = 4;
13
-
14
- exports.Parser = function ENCasualTimeParser(){
15
-
16
- Parser.apply(this, arguments);
17
-
18
-
19
- this.pattern = function() { return PATTERN; }
20
-
21
- this.extract = function(text, ref, match, opt){
22
-
23
- var text = match[0].substr(match[1].length);
24
- var index = match.index + match[1].length;
25
- var result = new ParsedResult({
26
- index: index,
27
- text: text,
28
- ref: ref,
29
- });
30
-
31
- if(!match[TIME_MATCH]) TIME_MATCH = 3;
32
-
33
- if (match[TIME_MATCH] == "afternoon") {
34
-
35
- result.start.imply('hour', opt['afternoon'] ? opt['afternoon'] : 15);
36
-
37
- } else if (match[TIME_MATCH] == "evening") {
38
-
39
- result.start.imply('hour', opt['evening'] ? opt['evening'] : 18);
40
-
41
- } else if (match[TIME_MATCH] == "morning") {
42
-
43
- result.start.imply('hour', opt['morning'] ? opt['morning'] : 6);
44
-
45
- } else if (match[TIME_MATCH] == "noon") {
46
-
47
- result.start.imply('hour', opt['noon'] ? opt['noon'] : 12);
48
- }
49
-
50
- result.tags['ENCasualTimeParser'] = true;
51
- return result;
52
- };
53
- };
@@ -1,130 +0,0 @@
1
- /*
2
-
3
-
4
- */
5
-
6
- var moment = require('moment');
7
- var Parser = require('../parser').Parser;
8
- var ParsedResult = require('../../result').ParsedResult;
9
- var util = require('../../utils/EN');
10
-
11
- var TIME_UNIT =
12
- '(' + util.INTEGER_WORDS_PATTERN + '|[0-9]+|an?(?:\\s*few)?|half(?:\\s*an?)?)\\s*' +
13
- '(sec(?:onds?)?|min(?:ute)?s?|hours?|weeks?|days?|months?|years?)\\s*';
14
-
15
- var TIME_UNIT_STRICT =
16
- '([0-9]+|an?)\\s*' +
17
- '(seconds?|minutes?|hours?|days?)\\s*';
18
-
19
- var PATTERN_TIME_UNIT = new RegExp(TIME_UNIT, 'i');
20
- var PATTERN = new RegExp('' +
21
- '(\\W|^)' +
22
- '(?:within\\s*)?' +
23
- '((?:' + TIME_UNIT + ')+)' +
24
- '(?:ago|before|earlier)(?=(?:\\W|$))', 'i');
25
-
26
- var STRICT_PATTERN = new RegExp('' +
27
- '(\\W|^)' +
28
- '(?:within\\s*)?' +
29
- '((?:' + TIME_UNIT_STRICT + ')+)' +
30
- 'ago(?=(?:\\W|$))', 'i');
31
-
32
- exports.Parser = function ENTimeAgoFormatParser(){
33
- Parser.apply(this, arguments);
34
-
35
- this.pattern = function() {
36
- return this.isStrictMode()? STRICT_PATTERN : PATTERN;
37
- };
38
-
39
- this.extract = function(text, ref, match, opt){
40
-
41
- if (match.index > 0 && text[match.index-1].match(/\w/)) return null;
42
-
43
- var text = match[0];
44
- text = match[0].substr(match[1].length, match[0].length - match[1].length);
45
- index = match.index + match[1].length;
46
-
47
- var result = new ParsedResult({
48
- index: index,
49
- text: text,
50
- ref: ref
51
- });
52
-
53
- var fragments = extractDateTimeUnitFragments(match[2]);
54
- var date = moment(ref);
55
-
56
- for (var key in fragments) {
57
- date.add(-fragments[key], key);
58
- }
59
-
60
- if (fragments['hour'] > 0 || fragments['minute'] > 0 || fragments['second'] > 0) {
61
- result.start.assign('hour', date.hour());
62
- result.start.assign('minute', date.minute());
63
- result.start.assign('second', date.second());
64
- result.tags['ENTimeAgoFormatParser'] = true;
65
- }
66
-
67
- if (fragments['d'] > 0 || fragments['month'] > 0 || fragments['year'] > 0) {
68
- result.start.assign('day', date.date());
69
- result.start.assign('month', date.month() + 1);
70
- result.start.assign('year', date.year());
71
- } else {
72
- if (fragments['week'] > 0) {
73
- result.start.imply('weekday', date.day());
74
- }
75
-
76
- result.start.imply('day', date.date());
77
- result.start.imply('month', date.month() + 1);
78
- result.start.imply('year', date.year());
79
- }
80
-
81
- return result;
82
- };
83
-
84
- function extractDateTimeUnitFragments(timeunitText) {
85
- var fragments = {};
86
- var remainingText = timeunitText;
87
- var match = PATTERN_TIME_UNIT.exec(remainingText);
88
- while (match) {
89
- collectDateTimeFragment(match, fragments);
90
- remainingText = remainingText.substring(match[0].length);
91
- match = PATTERN_TIME_UNIT.exec(remainingText);
92
- }
93
- return fragments;
94
- };
95
-
96
- function collectDateTimeFragment(match, fragments) {
97
-
98
- var num = match[1].toLowerCase() ;
99
- if (util.INTEGER_WORDS[num] !== undefined) {
100
- num = util.INTEGER_WORDS[num];
101
- } else if(num === 'a' || num === 'an'){
102
- num = 1;
103
- } else if (num.match(/few/)) {
104
- num = 3;
105
- } else if (num.match(/half/)) {
106
- num = 0.5;
107
- } else {
108
- num = parseInt(num);
109
- }
110
-
111
- if (match[2].match(/hour/i)) {
112
- fragments['hour'] = num;
113
- } else if (match[2].match(/min/i)) {
114
- fragments['minute'] = num;
115
- } else if (match[2].match(/sec/i)) {
116
- fragments['second'] = num;
117
- } else if (match[2].match(/week/i)) {
118
- fragments['week'] = num;
119
- } else if (match[2].match(/day/i)) {
120
- fragments['d'] = num;
121
- } else if (match[2].match(/month/i)) {
122
- fragments['month'] = num;
123
- } else if (match[2].match(/year/i)) {
124
- fragments['year'] = num;
125
- }
126
-
127
- return fragments;
128
- }
129
-
130
- }
@@ -1,119 +0,0 @@
1
- /*
2
- Allows future dates according to 'days from now'
3
- eg:
4
- 90 days from now
5
- 90 days forward
6
- 90 days out
7
- */
8
-
9
- var moment = require('moment');
10
- var Parser = require('../parser').Parser;
11
- var ParsedResult = require('../../result').ParsedResult;
12
- var util = require('../../utils/EN');
13
-
14
- var PATTERN = new RegExp('' +
15
- '(\\W|^)' +
16
- '(?:within\\s*)?' +
17
- '(' + util.INTEGER_WORDS_PATTERN + '|[0-9]+|an?(?:\\s*few)?|half(?:\\s*an?)?)\\s*' +
18
- '(seconds?|min(?:ute)?s?|hours?|weeks?|days?|months?|years?)\\s*' +
19
- '(?:from now|henceforth|forward|out)(?=(?:\\W|$))', 'i');
20
-
21
- var STRICT_PATTERN = new RegExp('' +
22
- '(\\W|^)' +
23
- '(?:within\\s*)?' +
24
- '([0-9]+|an?)\\s*' +
25
- '(seconds?|minutes?|hours?|days?)\\s*' +
26
- 'from now(?=(?:\\W|$))', 'i');
27
-
28
- exports.Parser = function ENTimeFromNowFormatParser() {
29
- Parser.apply(this, arguments);
30
-
31
- this.pattern = function() {
32
- return this.isStrictMode() ? STRICT_PATTERN : PATTERN;
33
- };
34
-
35
- this.extract = function(text, ref, match, opt) {
36
-
37
- if (match.index > 0 && text[match.index-1].match(/\w/)) {
38
- return null;
39
- }
40
-
41
- var text = match[0];
42
- text = match[0].substr(match[1].length, match[0].length - match[1].length);
43
- index = match.index + match[1].length;
44
-
45
- var result = new ParsedResult({
46
- index: index,
47
- text: text,
48
- ref: ref
49
- });
50
-
51
- var num = match[2].toLowerCase() ;
52
- if (util.INTEGER_WORDS[num] !== undefined) {
53
- num = util.INTEGER_WORDS[num];
54
- } else if(num === 'a' || num === 'an'){
55
- num = 1;
56
- } else if (num.match(/few/)) {
57
- num = 3;
58
- } else if (num.match(/half/)) {
59
- num = 0.5;
60
- } else {
61
- num = parseInt(num);
62
- }
63
-
64
- var date = moment(ref);
65
-
66
- if (match[3].match(/hour|min|second/i)) {
67
- if (match[3].match(/hour/i)) {
68
-
69
- date.add(+num, 'hour');
70
-
71
- } else if (match[3].match(/min/i)) {
72
-
73
- date.add(+num, 'minute');
74
-
75
- } else if (match[3].match(/second/i)) {
76
-
77
- date.add(+num, 'second');
78
- }
79
-
80
- result.start.imply('day', date.date());
81
- result.start.imply('month', date.month() + 1);
82
- result.start.imply('year', date.year());
83
- result.start.assign('hour', date.hour());
84
- result.start.assign('minute', date.minute());
85
- result.start.assign('second', date.second());
86
- result.tags['ENTimeFromNowFormatParser'] = true;
87
- return result;
88
- }
89
-
90
- if (match[3].match(/week/i)) {
91
- date.add(+num, 'week');
92
-
93
- result.start.imply('day', date.date());
94
- result.start.imply('month', date.month() + 1);
95
- result.start.imply('year', date.year());
96
- result.start.imply('weekday', date.day());
97
- return result;
98
- }
99
-
100
- if (match[3].match(/day/i)) {
101
- date.add(+num, 'd');
102
- }
103
-
104
- if (match[3].match(/month/i)) {
105
- date.add(+num, 'month');
106
- }
107
-
108
- if (match[3].match(/year/i)) {
109
-
110
- date.add(+num, 'year');
111
- }
112
-
113
- result.start.assign('day', date.date());
114
- result.start.assign('month', date.month() + 1);
115
- result.start.assign('year', date.year());
116
- return result;
117
-
118
- };
119
- }
@@ -1,88 +0,0 @@
1
- /*
2
-
3
-
4
- */
5
-
6
- var moment = require('moment');
7
-
8
- var Parser = require('../parser').Parser;
9
- var ParsedResult = require('../../result').ParsedResult;
10
-
11
- var util = require('../../utils/JP');
12
- var PATTERN = /(?:(同|((昭和|平成)?([0-90-9]{2,4})))年\s*)?([0-90-9]{1,2})月\s*([0-90-9]{1,2})日/i;
13
-
14
- var YEAR_GROUP = 2;
15
- var ERA_GROUP = 3;
16
- var YEAR_NUMBER_GROUP = 4;
17
- var MONTH_GROUP = 5;
18
- var DAY_GROUP = 6;
19
-
20
- exports.Parser = function JPStandardParser(){
21
- Parser.apply(this, arguments);
22
-
23
- this.pattern = function() { return PATTERN; }
24
-
25
- this.extract = function(text, ref, match, opt){
26
-
27
- var startMoment = moment(ref);
28
- var result = new ParsedResult({
29
- text: match[0],
30
- index: match.index,
31
- ref: ref,
32
- });
33
-
34
- var month = match[MONTH_GROUP];
35
- month = util.toHankaku(month);
36
- month = parseInt(month);
37
-
38
- var day = match[DAY_GROUP];
39
- day = util.toHankaku(day);
40
- day = parseInt(day);
41
-
42
- startMoment.set('date', day);
43
- startMoment.set('month', month - 1);
44
- result.start.assign('day', startMoment.date());
45
- result.start.assign('month', startMoment.month() + 1);
46
-
47
- if (!match[YEAR_GROUP]) {
48
-
49
- //Find the most appropriated year
50
- startMoment.year(moment(ref).year());
51
- var nextYear = startMoment.clone().add(1, 'y');
52
- var lastYear = startMoment.clone().add(-1, 'y');
53
- if( Math.abs(nextYear.diff(moment(ref))) < Math.abs(startMoment.diff(moment(ref))) ){
54
- startMoment = nextYear;
55
- }
56
- else if( Math.abs(lastYear.diff(moment(ref))) < Math.abs(startMoment.diff(moment(ref))) ){
57
- startMoment = lastYear;
58
- }
59
-
60
- result.start.assign('day', startMoment.date());
61
- result.start.assign('month', startMoment.month() + 1);
62
- result.start.imply('year', startMoment.year());
63
-
64
- } else if (match[YEAR_GROUP].match('同年')) {
65
-
66
- result.start.assign('year', startMoment.year());
67
-
68
- } else {
69
- var year = match[YEAR_NUMBER_GROUP];
70
- year = util.toHankaku(year);
71
- year = parseInt(year);
72
-
73
- if (match[ERA_GROUP] == '平成') {
74
- year += 1988;
75
- } else if (match[ERA_GROUP] == '昭和') {
76
- year += 1925;
77
- }
78
-
79
- result.start.assign('year', year);
80
- }
81
-
82
-
83
- result.tags['JPStandardParser'] = true;
84
- return result;
85
- };
86
-
87
- }
88
-
package/test/test_de.js DELETED
@@ -1,62 +0,0 @@
1
- // QUnit Setup
2
- //-------------------------------------
3
-
4
- var test = function() {
5
- QUnit.test.apply(QUnit.test, arguments);
6
- }
7
-
8
- var ok = function() {
9
- QUnit.assert.ok.apply(QUnit.assert, arguments);
10
- }
11
-
12
- //-------------------------------------
13
- test('Test - Random text', function() {
14
-
15
- var text = "...Donnerstag, 15. Dezember 2011 Best Available Rate "
16
- var results = chrono.parse(text);
17
- ok(results.length >= 1, JSON.stringify(results) )
18
- ok(results[0].start.get('day') == 15, JSON.stringify(results) )
19
- ok(results[0].start.get('month') == 12, JSON.stringify(results) )
20
- ok(results[0].start.get('year') == 2011, JSON.stringify(results) )
21
-
22
-
23
- var text = "9:00 bis 17:00, Dienstag, 20. Mai 2013"
24
- var results = chrono.parse(text);
25
- ok(results.length == 1, JSON.stringify(results) )
26
- ok(results[0].start.get('hour') == 9, JSON.stringify(results) )
27
- ok(results[0].end.get('hour') == 17, JSON.stringify(results) )
28
- ok(results[0].end.get('meridiem') == 1, JSON.stringify(results))
29
- ok(results[0].end.get('day') == 20, JSON.stringify(results))
30
- ok(results[0].end.get('month') == 5, JSON.stringify(results))
31
- ok(results[0].end.get('year') == 2013, JSON.stringify(results))
32
- });
33
-
34
-
35
- test('Test - German support in default setting', function() {
36
-
37
- // German's formal text should be handle by default casual and strict
38
-
39
- var text = "9:00 bis 17:00, Dienstag, 20. Mai 2013";
40
-
41
- var results = chrono.parse(text);
42
- ok(results.length == 1, JSON.stringify(results) );
43
-
44
- var results = chrono.strict.parse(text);
45
- ok(results.length == 1, JSON.stringify(results) );
46
-
47
- var results = chrono.de.parse(text);
48
- ok(results.length == 1, JSON.stringify(results) );
49
-
50
- // German's casual text (e.g. "do" is abbreviation of "Donnerstag")should be skipped
51
-
52
- var text = "Do";
53
-
54
- var results = chrono.parse(text);
55
- ok(results.length == 0, JSON.stringify(results) );
56
-
57
- var results = chrono.strict.parse(text);
58
- ok(results.length == 0, JSON.stringify(results) );
59
-
60
- var results = chrono.de.parse(text);
61
- ok(results.length == 1, JSON.stringify(results) );
62
- });