@instantdb/core 0.22.76 → 0.22.77
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__/src/utils/dates.test.ts +5 -0
- package/dist/commonjs/utils/dates.d.ts.map +1 -1
- package/dist/commonjs/utils/dates.js +16 -0
- package/dist/commonjs/utils/dates.js.map +1 -1
- package/dist/esm/utils/dates.d.ts.map +1 -1
- package/dist/esm/utils/dates.js +16 -0
- package/dist/esm/utils/dates.js.map +1 -1
- package/dist/standalone/index.js +345 -336
- package/dist/standalone/index.umd.cjs +3 -3
- package/package.json +2 -2
- package/src/utils/dates.ts +19 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instantdb/core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.77",
|
|
4
4
|
"description": "Instant's core local abstraction",
|
|
5
5
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/core",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"mutative": "^1.0.10",
|
|
55
55
|
"uuid": "^11.1.0",
|
|
56
|
-
"@instantdb/version": "0.22.
|
|
56
|
+
"@instantdb/version": "0.22.77"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"test": "vitest",
|
package/src/utils/dates.ts
CHANGED
|
@@ -91,6 +91,24 @@ function iso8601IncompleteOffsetToInstant(s) {
|
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
function iso8601SingleDigitToInstant(s) {
|
|
95
|
+
// Format: "2025-11-2T00:00:00.000Z" or "2025-1-2T00:00:00Z" (single-digit month/day)
|
|
96
|
+
// Also handles space separator: "2025-1-2 00:00:00"
|
|
97
|
+
// Normalize to proper ISO 8601 format with two-digit month and day
|
|
98
|
+
const regex = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/;
|
|
99
|
+
const match = s.match(regex);
|
|
100
|
+
|
|
101
|
+
if (match) {
|
|
102
|
+
const [, year, month, day, separator, rest] = match;
|
|
103
|
+
const paddedMonth = month.padStart(2, '0');
|
|
104
|
+
const paddedDay = day.padStart(2, '0');
|
|
105
|
+
const correctedString = `${year}-${paddedMonth}-${paddedDay}T${rest}`;
|
|
106
|
+
return new Date(correctedString);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
|
|
94
112
|
function usDateTimeStrToInstant(s) {
|
|
95
113
|
// Format: "M/d/yyyy, h:mm:ss a" (e.g., "8/4/2025, 11:02:31 PM")
|
|
96
114
|
const [datePart, timePart] = s.split(', ');
|
|
@@ -161,6 +179,7 @@ const dateParsers = [
|
|
|
161
179
|
zonedDateTimeStrToInstant,
|
|
162
180
|
specialStrToInstant,
|
|
163
181
|
pgTimezoneStrToInstant,
|
|
182
|
+
iso8601SingleDigitToInstant,
|
|
164
183
|
];
|
|
165
184
|
|
|
166
185
|
// Try to parse with a specific parser
|