@cityssm/utils-datetime 1.1.0 → 1.1.1
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/dateIntegerToDate.ts +1 -1
- package/dateIntegerToString.ts +1 -1
- package/isValidDateInteger.d.ts +1 -1
- package/isValidDateInteger.ts +3 -1
- package/isValidDateString.d.ts +2 -1
- package/isValidDateString.ts +5 -1
- package/isValidTimeInteger.d.ts +1 -1
- package/isValidTimeInteger.ts +3 -1
- package/isValidTimeString.d.ts +2 -1
- package/isValidTimeString.ts +5 -1
- package/package.json +1 -1
package/dateIntegerToDate.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function dateIntegerToDate(
|
|
|
22
22
|
return undefined
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const dateString = `00000000${
|
|
25
|
+
const dateString = `00000000${dateInteger.toString()}`.slice(-8)
|
|
26
26
|
|
|
27
27
|
const timeString = `0000${(timeInteger ?? 0).toString()}`.slice(-4)
|
|
28
28
|
|
package/dateIntegerToString.ts
CHANGED
package/isValidDateInteger.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function isValidDateInteger(possibleDateInteger: unknown):
|
|
1
|
+
export declare function isValidDateInteger(possibleDateInteger: unknown): possibleDateInteger is number;
|
package/isValidDateInteger.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* @param {unknown} possibleDateInteger - A possible date number
|
|
4
4
|
* @returns {boolean} - True if the possible date integer is valid.
|
|
5
5
|
*/
|
|
6
|
-
export function isValidDateInteger(
|
|
6
|
+
export function isValidDateInteger(
|
|
7
|
+
possibleDateInteger: unknown
|
|
8
|
+
): possibleDateInteger is number {
|
|
7
9
|
return (
|
|
8
10
|
typeof possibleDateInteger === 'number' &&
|
|
9
11
|
possibleDateInteger >= 101 &&
|
package/isValidDateString.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DateString } from './dateTimeTypes.js';
|
|
2
|
+
export declare function isValidDateString(possibleDateString: unknown): possibleDateString is DateString;
|
package/isValidDateString.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { DateString } from './dateTimeTypes.js'
|
|
2
|
+
|
|
1
3
|
const dateStringRegex = /^\d{4}-[01]\d-[0-3]\d$/
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -5,7 +7,9 @@ const dateStringRegex = /^\d{4}-[01]\d-[0-3]\d$/
|
|
|
5
7
|
* @param {unknown} possibleDateString - A possible date string
|
|
6
8
|
* @returns {boolean} - True when the possible date string is valid
|
|
7
9
|
*/
|
|
8
|
-
export function isValidDateString(
|
|
10
|
+
export function isValidDateString(
|
|
11
|
+
possibleDateString: unknown
|
|
12
|
+
): possibleDateString is DateString {
|
|
9
13
|
return (
|
|
10
14
|
typeof possibleDateString === 'string' &&
|
|
11
15
|
(possibleDateString ?? '').length === 10 &&
|
package/isValidTimeInteger.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function isValidTimeInteger(possibleTimeInteger: unknown):
|
|
1
|
+
export declare function isValidTimeInteger(possibleTimeInteger: unknown): possibleTimeInteger is number;
|
package/isValidTimeInteger.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* @param {unknown} possibleTimeInteger - A possible time number
|
|
4
4
|
* @returns {boolean} - True if the possible time integer is valid.
|
|
5
5
|
*/
|
|
6
|
-
export function isValidTimeInteger(
|
|
6
|
+
export function isValidTimeInteger(
|
|
7
|
+
possibleTimeInteger: unknown
|
|
8
|
+
): possibleTimeInteger is number {
|
|
7
9
|
return (
|
|
8
10
|
typeof possibleTimeInteger === 'number' &&
|
|
9
11
|
possibleTimeInteger >= 0 &&
|
package/isValidTimeString.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TimeString } from './dateTimeTypes.js';
|
|
2
|
+
export declare function isValidTimeString(possibleTimeString: unknown): possibleTimeString is TimeString;
|
package/isValidTimeString.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { TimeString } from './dateTimeTypes.js'
|
|
2
|
+
|
|
1
3
|
const timeStringRegex = /^[01]\d:[0-5]\d$/
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -5,7 +7,9 @@ const timeStringRegex = /^[01]\d:[0-5]\d$/
|
|
|
5
7
|
* @param {unknown} possibleTimeString - A possible time string.
|
|
6
8
|
* @returns {boolean} - True when the possible time string is valid.
|
|
7
9
|
*/
|
|
8
|
-
export function isValidTimeString(
|
|
10
|
+
export function isValidTimeString(
|
|
11
|
+
possibleTimeString: unknown
|
|
12
|
+
): possibleTimeString is TimeString {
|
|
9
13
|
return (
|
|
10
14
|
typeof possibleTimeString === 'string' &&
|
|
11
15
|
(possibleTimeString ?? '').length === 5 &&
|