@bbn/bbn 2.0.92 → 2.0.94
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/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/dt/functions/guessFormat.js +6 -4
- package/dist/dt.js +0 -26
- package/dist/fn/datetime/calendar.d.ts +1 -1
- package/dist/fn/datetime/calendar.js +2 -2
- package/dist/fn/datetime/dateSQL.d.ts +1 -1
- package/dist/fn/datetime/dateSQL.js +2 -2
- package/dist/fn/datetime/fdate.d.ts +1 -1
- package/dist/fn/datetime/fdate.js +2 -2
- package/dist/fn/datetime/fdatetime.d.ts +1 -1
- package/dist/fn/datetime/fdatetime.js +2 -2
- package/dist/fn/datetime/formatDate.d.ts +1 -1
- package/dist/fn/datetime/formatDate.js +2 -2
- package/dist/fn/datetime/ftime.js +2 -2
- package/package.json +1 -1
|
@@ -4,14 +4,11 @@ import buildLocaleFromIntl from './buildLocaleFromIntl.js';
|
|
|
4
4
|
const MYSQL_AND_NATIVE_FORMATS = [
|
|
5
5
|
// --- MySQL / MariaDB classic ---
|
|
6
6
|
// Date
|
|
7
|
-
'YYYY-MM-DD',
|
|
8
7
|
// Date + time
|
|
9
8
|
'YYYY-MM-DD HH:II:SS.ms',
|
|
10
9
|
'YYYY-MM-DD HH:II:SS',
|
|
11
10
|
'YYYY-MM-DD HH:II',
|
|
12
11
|
// Time only
|
|
13
|
-
'HH:II:SS',
|
|
14
|
-
'HH:II',
|
|
15
12
|
// --- ISO 8601 / JS toISOString() ---
|
|
16
13
|
// 2025-11-22T14:30:00.123Z
|
|
17
14
|
'YYYY-MM-DDTHH:II:SS.msZ',
|
|
@@ -28,7 +25,12 @@ const MYSQL_AND_NATIVE_FORMATS = [
|
|
|
28
25
|
// Tue Oct 29 2024 14:30:00 GMT+0200
|
|
29
26
|
'ddd MMM DD YYYY HH:II:SS[ GMT]Z',
|
|
30
27
|
// Tue Oct 29 2024 14:30:00
|
|
31
|
-
'ddd MMM DD YYYY HH:II:SS'
|
|
28
|
+
'ddd MMM DD YYYY HH:II:SS',
|
|
29
|
+
'YYYY-MM-DD',
|
|
30
|
+
'YYYY-MM',
|
|
31
|
+
'MM-DD',
|
|
32
|
+
'HH:II:SS',
|
|
33
|
+
'HH:II',
|
|
32
34
|
];
|
|
33
35
|
export default function guessFormat(input, formats, lng) {
|
|
34
36
|
const str = input.trim();
|
package/dist/dt.js
CHANGED
|
@@ -62,32 +62,6 @@ const patterns = [
|
|
|
62
62
|
second: m[6] !== undefined ? +m[6] : 0,
|
|
63
63
|
})
|
|
64
64
|
},
|
|
65
|
-
// Simple slash date "YYYY/MM/DD"
|
|
66
|
-
{
|
|
67
|
-
name: 'slash-date',
|
|
68
|
-
re: /^(\d{2})\/(\d{2})\/(\d{4})$/,
|
|
69
|
-
map: m => ({
|
|
70
|
-
year: +m[3],
|
|
71
|
-
month: +m[2],
|
|
72
|
-
day: +m[1],
|
|
73
|
-
hour: 0,
|
|
74
|
-
minute: 0,
|
|
75
|
-
second: 0,
|
|
76
|
-
})
|
|
77
|
-
},
|
|
78
|
-
// Slash datetime "YYYY/MM/DD HH:MM:SS"
|
|
79
|
-
{
|
|
80
|
-
name: 'slash-datetime',
|
|
81
|
-
re: /^(\d{2})\/(\d{2})\/(\d{4})[ T](\d{2}):(\d{2}):(\d{2})$/,
|
|
82
|
-
map: m => ({
|
|
83
|
-
year: +m[3],
|
|
84
|
-
month: +m[2],
|
|
85
|
-
day: +m[1],
|
|
86
|
-
hour: +m[4],
|
|
87
|
-
minute: +m[5],
|
|
88
|
-
second: +m[6],
|
|
89
|
-
})
|
|
90
|
-
},
|
|
91
65
|
];
|
|
92
66
|
const units = [
|
|
93
67
|
['y', "year", 365 * 24 * 60 * 60 * 1000],
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
* @param {String | Boolean} wrong_result Whether or not include the time in the date
|
|
17
17
|
* @returns {String}
|
|
18
18
|
*/
|
|
19
|
-
export default function calendar(d: any, wrong_result?: boolean):
|
|
19
|
+
export default function calendar(d: any, wrong_result?: boolean): any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dt from '../../dt.js';
|
|
2
2
|
import isString from '../type/isString.js';
|
|
3
3
|
const bbn = {
|
|
4
4
|
_: st => st
|
|
@@ -22,7 +22,7 @@ const bbn = {
|
|
|
22
22
|
* @returns {String}
|
|
23
23
|
*/
|
|
24
24
|
export default function calendar(d, wrong_result = false) {
|
|
25
|
-
let r =
|
|
25
|
+
let r = dt(d);
|
|
26
26
|
if (!r.isValid) {
|
|
27
27
|
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
28
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dt from '../../dt.js';
|
|
2
2
|
/**
|
|
3
3
|
* Returns a date with SQL format.
|
|
4
4
|
*
|
|
@@ -18,7 +18,7 @@ import date from '../../date.js';
|
|
|
18
18
|
* @returns {String}
|
|
19
19
|
*/
|
|
20
20
|
export default function dateSQL(v, dayOnly) {
|
|
21
|
-
let value =
|
|
21
|
+
let value = dt(v);
|
|
22
22
|
if (value) {
|
|
23
23
|
return value.format('YYYY-MM-DD' + (dayOnly ? '' : ' HH:mm:ss'));
|
|
24
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dt from '../../dt.js';
|
|
2
2
|
import isString from '../type/isString.js';
|
|
3
3
|
/**
|
|
4
4
|
* @method fdate
|
|
@@ -10,7 +10,7 @@ import isString from '../type/isString.js';
|
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
12
|
export default function fdate(d, wrong_result = false) {
|
|
13
|
-
let r =
|
|
13
|
+
let r = dt(d);
|
|
14
14
|
let time = false;
|
|
15
15
|
// Retro compatibility
|
|
16
16
|
if (wrong_result === true) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dt from '../../dt.js';
|
|
2
2
|
import isString from '../type/isString.js';
|
|
3
3
|
/**
|
|
4
4
|
* @method fdatetime
|
|
@@ -8,7 +8,7 @@ import isString from '../type/isString.js';
|
|
|
8
8
|
* @returns {*}
|
|
9
9
|
*/
|
|
10
10
|
export default function fdatetime(d, wrong_result = false) {
|
|
11
|
-
let r =
|
|
11
|
+
let r = dt(d);
|
|
12
12
|
if (!r.isValid) {
|
|
13
13
|
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function formatDate(dateToFormat: any, format: any):
|
|
1
|
+
export default function formatDate(dateToFormat: any, format: any): any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dt from '../../dt.js';
|
|
2
2
|
import isString from '../type/isString.js';
|
|
3
3
|
/**
|
|
4
4
|
* @method ftime
|
|
@@ -8,7 +8,7 @@ import isString from '../type/isString.js';
|
|
|
8
8
|
* @returns {*}
|
|
9
9
|
*/
|
|
10
10
|
export default function ftime(d, wrong_result) {
|
|
11
|
-
let r =
|
|
11
|
+
let r = dt(d);
|
|
12
12
|
if (!r.isValid) {
|
|
13
13
|
return wrong_result && isString(wrong_result) ? wrong_result : '';
|
|
14
14
|
}
|