@bbn/bbn 1.0.106 → 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 +18 -0
- package/dist/bundle.js +27 -2
- package/dist/fn/datetime/calendar.d.ts +18 -0
- package/dist/fn/datetime/calendar.js +27 -2
- package/package.json +1 -1
package/dist/bundle.d.ts
CHANGED
|
@@ -1792,6 +1792,24 @@ declare module "fn/datetime/fdate" {
|
|
|
1792
1792
|
export { fdate };
|
|
1793
1793
|
}
|
|
1794
1794
|
declare module "fn/datetime/calendar" {
|
|
1795
|
+
/**
|
|
1796
|
+
* Returns a date relative to the current day.
|
|
1797
|
+
*
|
|
1798
|
+
* @method calendar
|
|
1799
|
+
* @global
|
|
1800
|
+
*
|
|
1801
|
+
* @example
|
|
1802
|
+
* ``` javascript
|
|
1803
|
+
* //"2020-04-16 16:15:23"
|
|
1804
|
+
* let date = new Date();
|
|
1805
|
+
* bbn.fn.dateSQL(date,false);
|
|
1806
|
+
* ```
|
|
1807
|
+
*
|
|
1808
|
+
* @memberof bbn.fn
|
|
1809
|
+
* @param {Date|String} d
|
|
1810
|
+
* @param {String | Boolean} wrong_result Whether or not include the time in the date
|
|
1811
|
+
* @returns {String}
|
|
1812
|
+
*/
|
|
1795
1813
|
const calendar: (d: any, wrong_result?: boolean) => any;
|
|
1796
1814
|
export { calendar };
|
|
1797
1815
|
}
|
package/dist/bundle.js
CHANGED
|
@@ -3695,7 +3695,25 @@
|
|
|
3695
3695
|
"use strict";
|
|
3696
3696
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3697
3697
|
exports.calendar = void 0;
|
|
3698
|
-
|
|
3698
|
+
//dayjs.extend(window['dayjs_plugin_calendar']);
|
|
3699
|
+
/**
|
|
3700
|
+
* Returns a date relative to the current day.
|
|
3701
|
+
*
|
|
3702
|
+
* @method calendar
|
|
3703
|
+
* @global
|
|
3704
|
+
*
|
|
3705
|
+
* @example
|
|
3706
|
+
* ``` javascript
|
|
3707
|
+
* //"2020-04-16 16:15:23"
|
|
3708
|
+
* let date = new Date();
|
|
3709
|
+
* bbn.fn.dateSQL(date,false);
|
|
3710
|
+
* ```
|
|
3711
|
+
*
|
|
3712
|
+
* @memberof bbn.fn
|
|
3713
|
+
* @param {Date|String} d
|
|
3714
|
+
* @param {String | Boolean} wrong_result Whether or not include the time in the date
|
|
3715
|
+
* @returns {String}
|
|
3716
|
+
*/
|
|
3699
3717
|
const calendar = function (d, wrong_result = false) {
|
|
3700
3718
|
if (undefined === dayjs_min_js_1.default) {
|
|
3701
3719
|
return (0, fdate_js_1.fdate)(d, wrong_result);
|
|
@@ -3704,7 +3722,14 @@
|
|
|
3704
3722
|
if (!(0, isDate_js_5.isDate)(r)) {
|
|
3705
3723
|
return wrong_result && (0, isString_js_8.isString)(wrong_result) ? wrong_result : '';
|
|
3706
3724
|
}
|
|
3707
|
-
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
|
+
});
|
|
3708
3733
|
};
|
|
3709
3734
|
exports.calendar = calendar;
|
|
3710
3735
|
});
|
|
@@ -1,2 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a date relative to the current day.
|
|
3
|
+
*
|
|
4
|
+
* @method calendar
|
|
5
|
+
* @global
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ``` javascript
|
|
9
|
+
* //"2020-04-16 16:15:23"
|
|
10
|
+
* let date = new Date();
|
|
11
|
+
* bbn.fn.dateSQL(date,false);
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @memberof bbn.fn
|
|
15
|
+
* @param {Date|String} d
|
|
16
|
+
* @param {String | Boolean} wrong_result Whether or not include the time in the date
|
|
17
|
+
* @returns {String}
|
|
18
|
+
*/
|
|
1
19
|
declare const calendar: (d: any, wrong_result?: boolean) => any;
|
|
2
20
|
export { calendar };
|
|
@@ -3,7 +3,25 @@ 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
|
+
//dayjs.extend(window['dayjs_plugin_calendar']);
|
|
7
|
+
/**
|
|
8
|
+
* Returns a date relative to the current day.
|
|
9
|
+
*
|
|
10
|
+
* @method calendar
|
|
11
|
+
* @global
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ``` javascript
|
|
15
|
+
* //"2020-04-16 16:15:23"
|
|
16
|
+
* let date = new Date();
|
|
17
|
+
* bbn.fn.dateSQL(date,false);
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @memberof bbn.fn
|
|
21
|
+
* @param {Date|String} d
|
|
22
|
+
* @param {String | Boolean} wrong_result Whether or not include the time in the date
|
|
23
|
+
* @returns {String}
|
|
24
|
+
*/
|
|
7
25
|
const calendar = function (d, wrong_result = false) {
|
|
8
26
|
if (undefined === dayjs) {
|
|
9
27
|
return fdate(d, wrong_result);
|
|
@@ -12,6 +30,13 @@ const calendar = function (d, wrong_result = false) {
|
|
|
12
30
|
if (!isDate(r)) {
|
|
13
31
|
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
14
32
|
}
|
|
15
|
-
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
|
+
});
|
|
16
41
|
};
|
|
17
42
|
export { calendar };
|