@bbn/bbn 1.0.107 → 1.0.109

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.
package/dist/bundle.d.ts CHANGED
@@ -1793,9 +1793,9 @@ declare module "fn/datetime/fdate" {
1793
1793
  }
1794
1794
  declare module "fn/datetime/calendar" {
1795
1795
  /**
1796
- * Returns a date with SQL format.
1796
+ * Returns a date relative to the current day.
1797
1797
  *
1798
- * @method dateSQL
1798
+ * @method calendar
1799
1799
  * @global
1800
1800
  *
1801
1801
  * @example
@@ -1807,7 +1807,7 @@ declare module "fn/datetime/calendar" {
1807
1807
  *
1808
1808
  * @memberof bbn.fn
1809
1809
  * @param {Date|String} d
1810
- * @param {String | false} wrong_result Whether or not include the time in the date
1810
+ * @param {String | Boolean} wrong_result Whether or not include the time in the date
1811
1811
  * @returns {String}
1812
1812
  */
1813
1813
  const calendar: (d: any, wrong_result?: boolean) => any;
package/dist/bundle.js CHANGED
@@ -3695,10 +3695,14 @@
3695
3695
  "use strict";
3696
3696
  Object.defineProperty(exports, "__esModule", { value: true });
3697
3697
  exports.calendar = void 0;
3698
+ const bbn = {
3699
+ _: st => st
3700
+ };
3701
+ //dayjs.extend(window['dayjs_plugin_calendar']);
3698
3702
  /**
3699
- * Returns a date with SQL format.
3703
+ * Returns a date relative to the current day.
3700
3704
  *
3701
- * @method dateSQL
3705
+ * @method calendar
3702
3706
  * @global
3703
3707
  *
3704
3708
  * @example
@@ -3710,7 +3714,7 @@
3710
3714
  *
3711
3715
  * @memberof bbn.fn
3712
3716
  * @param {Date|String} d
3713
- * @param {String | false} wrong_result Whether or not include the time in the date
3717
+ * @param {String | Boolean} wrong_result Whether or not include the time in the date
3714
3718
  * @returns {String}
3715
3719
  */
3716
3720
  const calendar = function (d, wrong_result = false) {
@@ -3721,7 +3725,14 @@
3721
3725
  if (!(0, isDate_js_5.isDate)(r)) {
3722
3726
  return wrong_result && (0, isString_js_8.isString)(wrong_result) ? wrong_result : '';
3723
3727
  }
3724
- return '';
3728
+ return (0, dayjs_min_js_1.default)(r).calendar(null, {
3729
+ sameDay: '[' + bbn._('Today') + ']',
3730
+ nextDay: '[' + bbn._('Tomorrow') + ']',
3731
+ nextWeek: 'ddd D',
3732
+ lastDay: '[' + bbn._('Yesterday') + ']',
3733
+ lastWeek: 'ddd D',
3734
+ sameElse: 'L',
3735
+ });
3725
3736
  };
3726
3737
  exports.calendar = calendar;
3727
3738
  });
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Returns a date with SQL format.
2
+ * Returns a date relative to the current day.
3
3
  *
4
- * @method dateSQL
4
+ * @method calendar
5
5
  * @global
6
6
  *
7
7
  * @example
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @memberof bbn.fn
15
15
  * @param {Date|String} d
16
- * @param {String | false} wrong_result Whether or not include the time in the date
16
+ * @param {String | Boolean} wrong_result Whether or not include the time in the date
17
17
  * @returns {String}
18
18
  */
19
19
  declare const calendar: (d: any, wrong_result?: boolean) => any;
@@ -3,10 +3,14 @@ import { fdate } from "./fdate.js";
3
3
  import { date } from "./date.js";
4
4
  import { isDate } from "../type/isDate.js";
5
5
  import { isString } from "../type/isString.js";
6
+ const bbn = {
7
+ _: st => st
8
+ };
9
+ //dayjs.extend(window['dayjs_plugin_calendar']);
6
10
  /**
7
- * Returns a date with SQL format.
11
+ * Returns a date relative to the current day.
8
12
  *
9
- * @method dateSQL
13
+ * @method calendar
10
14
  * @global
11
15
  *
12
16
  * @example
@@ -18,7 +22,7 @@ import { isString } from "../type/isString.js";
18
22
  *
19
23
  * @memberof bbn.fn
20
24
  * @param {Date|String} d
21
- * @param {String | false} wrong_result Whether or not include the time in the date
25
+ * @param {String | Boolean} wrong_result Whether or not include the time in the date
22
26
  * @returns {String}
23
27
  */
24
28
  const calendar = function (d, wrong_result = false) {
@@ -29,6 +33,13 @@ const calendar = function (d, wrong_result = false) {
29
33
  if (!isDate(r)) {
30
34
  return wrong_result && isString(wrong_result) ? wrong_result : '';
31
35
  }
32
- return '';
36
+ return dayjs(r).calendar(null, {
37
+ sameDay: '[' + bbn._('Today') + ']',
38
+ nextDay: '[' + bbn._('Tomorrow') + ']',
39
+ nextWeek: 'ddd D',
40
+ lastDay: '[' + bbn._('Yesterday') + ']',
41
+ lastWeek: 'ddd D',
42
+ sameElse: 'L',
43
+ });
33
44
  };
34
45
  export { calendar };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.107",
3
+ "version": "1.0.109",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",