timeago.js 3.0.1 → 3.0.2

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 (83) hide show
  1. package/.npmignore +8 -8
  2. package/.travis.yml +2 -2
  3. package/LICENSE +20 -20
  4. package/README.md +189 -189
  5. package/README_zh.md +172 -172
  6. package/bower.json +21 -21
  7. package/demo/index.html +121 -0
  8. package/demo/index.js +25 -17
  9. package/dist/timeago.js +261 -258
  10. package/dist/timeago.locales.min.js +1 -1
  11. package/dist/timeago.min.js +1 -1
  12. package/gulpfile.js +13 -13
  13. package/index.html +185 -182
  14. package/locales/ar.js +26 -26
  15. package/locales/be.js +51 -51
  16. package/locales/bg.js +18 -18
  17. package/locales/ca.js +18 -18
  18. package/locales/da.js +18 -18
  19. package/locales/de.js +18 -18
  20. package/locales/el.js +18 -18
  21. package/locales/en.js +18 -18
  22. package/locales/en_short.js +17 -17
  23. package/locales/es.js +17 -17
  24. package/locales/eu.js +18 -18
  25. package/locales/fa.js +18 -0
  26. package/locales/fi.js +18 -18
  27. package/locales/fr.js +17 -17
  28. package/locales/he.js +18 -18
  29. package/locales/hu.js +18 -18
  30. package/locales/in_ID.js +18 -18
  31. package/locales/it.js +18 -18
  32. package/locales/ja.js +18 -18
  33. package/locales/ko.js +17 -17
  34. package/locales/locales.js +6 -6
  35. package/locales/ml.js +18 -18
  36. package/locales/my.js +18 -0
  37. package/locales/nl.js +18 -18
  38. package/locales/pl.js +34 -34
  39. package/locales/pt_BR.js +18 -18
  40. package/locales/ro.js +29 -29
  41. package/locales/ru.js +51 -51
  42. package/locales/sv.js +18 -18
  43. package/locales/ta.js +17 -17
  44. package/locales/th.js +18 -18
  45. package/locales/tr.js +18 -18
  46. package/locales/uk.js +40 -40
  47. package/locales/vi.js +18 -18
  48. package/locales/zh_CN.js +17 -17
  49. package/locales/zh_TW.js +17 -17
  50. package/package.json +49 -49
  51. package/src/timeago.js +261 -258
  52. package/src/timeago.locales.js +12 -12
  53. package/tests/locales/ar.js +66 -66
  54. package/tests/locales/be.js +63 -63
  55. package/tests/locales/bg.js +63 -63
  56. package/tests/locales/ca.js +64 -64
  57. package/tests/locales/en.js +62 -62
  58. package/tests/locales/en_short.js +62 -62
  59. package/tests/locales/eu.js +63 -63
  60. package/tests/locales/fa.js +63 -0
  61. package/tests/locales/fi.js +43 -43
  62. package/tests/locales/he.js +62 -62
  63. package/tests/locales/in_BG.js +63 -63
  64. package/tests/locales/in_HI.js +63 -63
  65. package/tests/locales/in_ID.js +62 -62
  66. package/tests/locales/ja.js +62 -62
  67. package/tests/locales/ko.js +62 -62
  68. package/tests/locales/my.js +63 -0
  69. package/tests/locales/pl.js +91 -91
  70. package/tests/locales/ro.js +61 -61
  71. package/tests/locales/ru.js +63 -63
  72. package/tests/locales/ta.js +62 -62
  73. package/tests/locales/tr.js +63 -63
  74. package/tests/locales/uk.js +63 -63
  75. package/tests/locales/vi.js +63 -63
  76. package/tests/locales/zh_CN.js +62 -62
  77. package/tests/locales_test.js +51 -51
  78. package/tests/test-builder.js +247 -247
  79. package/tests/test.js +83 -83
  80. package/tests/test_dev.js +44 -44
  81. package/tests/test_ts.ts +6 -6
  82. package/timeago.d.ts +14 -14
  83. package/webpack.config.js +10 -10
package/tests/test_dev.js CHANGED
@@ -1,45 +1,45 @@
1
- 'use strict';
2
-
3
- const test = require('tape');
4
- const timeago = require('..');
5
-
6
- test('timeago.js next interval show be tested', t => {
7
- t.true(timeago().nextInterval(0.134), 1);
8
- t.true(timeago().nextInterval(8.1), 1);
9
- t.true(timeago().nextInterval(59.3), 1);
10
-
11
- t.true(timeago().nextInterval(70.13), 50);
12
-
13
- t.true(timeago().nextInterval(60 * 3 + 10.01), 50);
14
- // 10 hours
15
- t.true(timeago().nextInterval(3600 * 10 + 100.01), 3500);
16
- // 3 days
17
- t.true(timeago().nextInterval(60 * 60 * 24 * 3 + 100.01), 3600 * 24 -100);
18
-
19
- // 2 weeks
20
- t.true(timeago().nextInterval(60 * 60 * 24 * 15 + 100.01), 3600 * 24 * 6 - 100);
21
-
22
- // 10 years
23
- t.true(timeago().nextInterval(3600 * 24 * 365 * 3 + 100.01), 3600 * 24 * 365 - 100);
24
-
25
- ////////////////////////////////////////
26
-
27
- t.true(timeago().nextInterval(-0.134), 1);
28
- t.true(timeago().nextInterval(-8.1), 1);
29
- t.true(timeago().nextInterval(-59.3), 1);
30
-
31
- t.true(timeago().nextInterval(-70.13), 50);
32
-
33
- t.true(timeago().nextInterval(-60 * 3 + 10.01), 50);
34
- // 10 hours
35
- t.true(timeago().nextInterval(-3600 * 10 + 100.01), 3500);
36
- // 3 days
37
- t.true(timeago().nextInterval(-60 * 60 * 24 * 3 + 100.01), 3600 * 24 -100);
38
-
39
- // 2 weeks
40
- t.true(timeago().nextInterval(-60 * 60 * 24 * 15 + 100.01), 3600 * 24 * 6 - 100);
41
-
42
- // 10 years
43
- t.true(timeago().nextInterval(-3600 * 24 * 365 * 3 + 100.01), 3600 * 24 * 365 - 100);
44
- t.end();
1
+ 'use strict';
2
+
3
+ const test = require('tape');
4
+ const timeago = require('..');
5
+
6
+ test('timeago.js next interval show be tested', t => {
7
+ t.true(timeago().nextInterval(0.134), 1);
8
+ t.true(timeago().nextInterval(8.1), 1);
9
+ t.true(timeago().nextInterval(59.3), 1);
10
+
11
+ t.true(timeago().nextInterval(70.13), 50);
12
+
13
+ t.true(timeago().nextInterval(60 * 3 + 10.01), 50);
14
+ // 10 hours
15
+ t.true(timeago().nextInterval(3600 * 10 + 100.01), 3500);
16
+ // 3 days
17
+ t.true(timeago().nextInterval(60 * 60 * 24 * 3 + 100.01), 3600 * 24 -100);
18
+
19
+ // 2 weeks
20
+ t.true(timeago().nextInterval(60 * 60 * 24 * 15 + 100.01), 3600 * 24 * 6 - 100);
21
+
22
+ // 10 years
23
+ t.true(timeago().nextInterval(3600 * 24 * 365 * 3 + 100.01), 3600 * 24 * 365 - 100);
24
+
25
+ ////////////////////////////////////////
26
+
27
+ t.true(timeago().nextInterval(-0.134), 1);
28
+ t.true(timeago().nextInterval(-8.1), 1);
29
+ t.true(timeago().nextInterval(-59.3), 1);
30
+
31
+ t.true(timeago().nextInterval(-70.13), 50);
32
+
33
+ t.true(timeago().nextInterval(-60 * 3 + 10.01), 50);
34
+ // 10 hours
35
+ t.true(timeago().nextInterval(-3600 * 10 + 100.01), 3500);
36
+ // 3 days
37
+ t.true(timeago().nextInterval(-60 * 60 * 24 * 3 + 100.01), 3600 * 24 -100);
38
+
39
+ // 2 weeks
40
+ t.true(timeago().nextInterval(-60 * 60 * 24 * 15 + 100.01), 3600 * 24 * 6 - 100);
41
+
42
+ // 10 years
43
+ t.true(timeago().nextInterval(-3600 * 24 * 365 * 3 + 100.01), 3600 * 24 * 365 - 100);
44
+ t.end();
45
45
  });
package/tests/test_ts.ts CHANGED
@@ -1,7 +1,7 @@
1
- // just test typescript can be compiled and ran.
2
- // TODO: if trace or error, travis-ci will error
3
-
4
- console.log('run typescript.')
5
- import timeago from '..'
6
- const timeagoInstance = timeago()
1
+ // just test typescript can be compiled and ran.
2
+ // TODO: if trace or error, travis-ci will error
3
+
4
+ console.log('run typescript.')
5
+ import timeago from '..'
6
+ const timeagoInstance = timeago()
7
7
  console.log(timeagoInstance.format('01-01-2017'))
package/timeago.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- /// <reference types="jquery" />
2
- type TDate = Date | string | number;
3
- export interface TimeAgoInterface {
4
- format(date: TDate, locale?: string): string;
5
- render<T>(nodes: Node | NodeList | JQuery, locale?: string): void;
6
- setLocale(locale: string): void;
7
- }
8
- export interface TimeagoFactory {
9
- (): TimeAgoInterface;
10
- (nowDate: TDate, defaultLocale?: string): TimeAgoInterface;
11
- cancel(node?: Node | JQuery): void;
12
- register(locale: string, localeFunc: Function): void;
13
- }
14
- declare let timeagoFactory: TimeagoFactory;
1
+ /// <reference types="jquery" />
2
+ type TDate = Date | string | number;
3
+ export interface TimeAgoInterface {
4
+ format(date: TDate, locale?: string): string;
5
+ render<T>(nodes: Node | NodeList | JQuery, locale?: string): void;
6
+ setLocale(locale: string): void;
7
+ }
8
+ export interface TimeagoFactory {
9
+ (): TimeAgoInterface;
10
+ (nowDate: TDate, defaultLocale?: string): TimeAgoInterface;
11
+ cancel(node?: Node | JQuery): void;
12
+ register(locale: string, localeFunc: Function): void;
13
+ }
14
+ declare let timeagoFactory: TimeagoFactory;
15
15
  export default timeagoFactory;
package/webpack.config.js CHANGED
@@ -1,11 +1,11 @@
1
- var webpack = require('webpack');
2
- var uglifyJsPlugin = new webpack.optimize.UglifyJsPlugin({
3
- output: {comments: false},
4
- compress: {warnings: false}
5
- });
6
-
7
- module.exports = {
8
- entry: './src/timeago.locales.js',
9
- output: {filename: './dist/timeago.locales.min.js'},
10
- plugins: [uglifyJsPlugin]
1
+ var webpack = require('webpack');
2
+ var uglifyJsPlugin = new webpack.optimize.UglifyJsPlugin({
3
+ output: {comments: false},
4
+ compress: {warnings: false}
5
+ });
6
+
7
+ module.exports = {
8
+ entry: './src/timeago.locales.js',
9
+ output: {filename: './dist/timeago.locales.min.js'},
10
+ plugins: [uglifyJsPlugin]
11
11
  };