@etsoo/shared 1.1.53 → 1.1.54
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/__tests__/DateUtils.ts +3 -3
- package/lib/cjs/DateUtils.js +5 -2
- package/lib/mjs/DateUtils.js +5 -2
- package/package.json +1 -1
- package/src/DateUtils.ts +5 -2
package/__tests__/DateUtils.ts
CHANGED
|
@@ -56,15 +56,15 @@ test('Tests for formatForInput', () => {
|
|
|
56
56
|
const result1 = DateUtils.formatForInput('2021/7/17');
|
|
57
57
|
expect(result1).toBe('2021-07-17');
|
|
58
58
|
|
|
59
|
-
const d = new Date(2021, 5, 6, 20,
|
|
59
|
+
const d = new Date(2021, 5, 6, 20, 8, 45);
|
|
60
60
|
const result2 = DateUtils.formatForInput(d);
|
|
61
61
|
expect(result2).toBe('2021-06-06');
|
|
62
62
|
|
|
63
63
|
const result3 = DateUtils.formatForInput(d, false);
|
|
64
|
-
expect(result3).toBe('2021-06-06T20:
|
|
64
|
+
expect(result3).toBe('2021-06-06T20:08');
|
|
65
65
|
|
|
66
66
|
const result4 = DateUtils.formatForInput(d, true);
|
|
67
|
-
expect(result4).toBe('2021-06-06T20:
|
|
67
|
+
expect(result4).toBe('2021-06-06T20:08:45');
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
test('Tests for substract', () => {
|
package/lib/cjs/DateUtils.js
CHANGED
|
@@ -112,9 +112,12 @@ var DateUtils;
|
|
|
112
112
|
const d = parts.join('-');
|
|
113
113
|
if (hasSecond == null)
|
|
114
114
|
return d;
|
|
115
|
-
const hm = [
|
|
115
|
+
const hm = [
|
|
116
|
+
date.getHours().toString().padStart(2, '0'),
|
|
117
|
+
date.getMinutes().toString().padStart(2, '0')
|
|
118
|
+
];
|
|
116
119
|
if (hasSecond)
|
|
117
|
-
hm.push(date.getSeconds());
|
|
120
|
+
hm.push(date.getSeconds().toString().padStart(2, '0'));
|
|
118
121
|
return `${d}T${hm.join(':')}`;
|
|
119
122
|
}
|
|
120
123
|
DateUtils.formatForInput = formatForInput;
|
package/lib/mjs/DateUtils.js
CHANGED
|
@@ -109,9 +109,12 @@ export var DateUtils;
|
|
|
109
109
|
const d = parts.join('-');
|
|
110
110
|
if (hasSecond == null)
|
|
111
111
|
return d;
|
|
112
|
-
const hm = [
|
|
112
|
+
const hm = [
|
|
113
|
+
date.getHours().toString().padStart(2, '0'),
|
|
114
|
+
date.getMinutes().toString().padStart(2, '0')
|
|
115
|
+
];
|
|
113
116
|
if (hasSecond)
|
|
114
|
-
hm.push(date.getSeconds());
|
|
117
|
+
hm.push(date.getSeconds().toString().padStart(2, '0'));
|
|
115
118
|
return `${d}T${hm.join(':')}`;
|
|
116
119
|
}
|
|
117
120
|
DateUtils.formatForInput = formatForInput;
|
package/package.json
CHANGED
package/src/DateUtils.ts
CHANGED
|
@@ -170,8 +170,11 @@ export namespace DateUtils {
|
|
|
170
170
|
const d = parts.join('-');
|
|
171
171
|
if (hasSecond == null) return d;
|
|
172
172
|
|
|
173
|
-
const hm = [
|
|
174
|
-
|
|
173
|
+
const hm = [
|
|
174
|
+
date.getHours().toString().padStart(2, '0'),
|
|
175
|
+
date.getMinutes().toString().padStart(2, '0')
|
|
176
|
+
];
|
|
177
|
+
if (hasSecond) hm.push(date.getSeconds().toString().padStart(2, '0'));
|
|
175
178
|
return `${d}T${hm.join(':')}`;
|
|
176
179
|
}
|
|
177
180
|
|