@bbn/bbn 1.0.107 → 1.0.108

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,11 @@
3695
3695
  "use strict";
3696
3696
  Object.defineProperty(exports, "__esModule", { value: true });
3697
3697
  exports.calendar = void 0;
3698
+ //dayjs.extend(window['dayjs_plugin_calendar']);
3698
3699
  /**
3699
- * Returns a date with SQL format.
3700
+ * Returns a date relative to the current day.
3700
3701
  *
3701
- * @method dateSQL
3702
+ * @method calendar
3702
3703
  * @global
3703
3704
  *
3704
3705
  * @example
@@ -3710,7 +3711,7 @@
3710
3711
  *
3711
3712
  * @memberof bbn.fn
3712
3713
  * @param {Date|String} d
3713
- * @param {String | false} wrong_result Whether or not include the time in the date
3714
+ * @param {String | Boolean} wrong_result Whether or not include the time in the date
3714
3715
  * @returns {String}
3715
3716
  */
3716
3717
  const calendar = function (d, wrong_result = false) {
@@ -3721,7 +3722,14 @@
3721
3722
  if (!(0, isDate_js_5.isDate)(r)) {
3722
3723
  return wrong_result && (0, isString_js_8.isString)(wrong_result) ? wrong_result : '';
3723
3724
  }
3724
- return '';
3725
+ return (0, dayjs_min_js_1.default)(r).calendar(null, {
3726
+ sameDay: '[' + bbn._('Today') + ']',
3727
+ nextDay: '[' + bbn._('Tomorrow') + ']',
3728
+ nextWeek: 'ddd D',
3729
+ lastDay: '[' + bbn._('Yesterday') + ']',
3730
+ lastWeek: 'ddd D',
3731
+ sameElse: 'L',
3732
+ });
3725
3733
  };
3726
3734
  exports.calendar = calendar;
3727
3735
  });
@@ -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,11 @@ 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
+ //dayjs.extend(window['dayjs_plugin_calendar']);
6
7
  /**
7
- * Returns a date with SQL format.
8
+ * Returns a date relative to the current day.
8
9
  *
9
- * @method dateSQL
10
+ * @method calendar
10
11
  * @global
11
12
  *
12
13
  * @example
@@ -18,7 +19,7 @@ import { isString } from "../type/isString.js";
18
19
  *
19
20
  * @memberof bbn.fn
20
21
  * @param {Date|String} d
21
- * @param {String | false} wrong_result Whether or not include the time in the date
22
+ * @param {String | Boolean} wrong_result Whether or not include the time in the date
22
23
  * @returns {String}
23
24
  */
24
25
  const calendar = function (d, wrong_result = false) {
@@ -29,6 +30,13 @@ const calendar = function (d, wrong_result = false) {
29
30
  if (!isDate(r)) {
30
31
  return wrong_result && isString(wrong_result) ? wrong_result : '';
31
32
  }
32
- return '';
33
+ return dayjs(r).calendar(null, {
34
+ sameDay: '[' + bbn._('Today') + ']',
35
+ nextDay: '[' + bbn._('Tomorrow') + ']',
36
+ nextWeek: 'ddd D',
37
+ lastDay: '[' + bbn._('Yesterday') + ']',
38
+ lastWeek: 'ddd D',
39
+ sameElse: 'L',
40
+ });
33
41
  };
34
42
  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.108",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",