@dabble/patches 0.5.0 → 0.5.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/dates.d.ts +2 -2
- package/dist/utils/dates.js +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { transformPatch } from './json-patch/transformPatch.js';
|
|
|
18
18
|
export { JSONPatch, PathLike, WriteOptions } from './json-patch/JSONPatch.js';
|
|
19
19
|
export { ApplyJSONPatchOptions, JSONPatchOpHandlerMap as JSONPatchCustomTypes, JSONPatchOp } from './json-patch/types.js';
|
|
20
20
|
export { Branch, BranchStatus, Change, ChangeInput, ChangeMutator, EditableBranchMetadata, EditableVersionMetadata, ListChangesOptions, ListVersionsOptions, PatchesSnapshot, PatchesState, PathProxy, SyncingState, VersionMetadata } from './types.js';
|
|
21
|
+
export { clampTimestamp, createClientTimestamp, createServerTimestamp, extractTimezoneOffset, formatDateWithOffset, getLocalTimezoneOffset, parseTimestamp, timestampDiff } from './utils/dates.js';
|
|
21
22
|
export { add } from './json-patch/ops/add.js';
|
|
22
23
|
export { copy } from './json-patch/ops/copy.js';
|
|
23
24
|
export { increment } from './json-patch/ops/increment.js';
|
package/dist/index.js
CHANGED
package/dist/utils/dates.d.ts
CHANGED
|
@@ -42,11 +42,11 @@ declare function clampTimestamp(timestamp: string, limit: string): string;
|
|
|
42
42
|
* Formats a Date with a specific timezone offset string.
|
|
43
43
|
* The date is adjusted to display the correct local time for that offset.
|
|
44
44
|
*/
|
|
45
|
-
declare function
|
|
45
|
+
declare function formatDateWithOffset(date: Date, offset: string): string;
|
|
46
46
|
/**
|
|
47
47
|
* Gets the local timezone offset string for the current environment.
|
|
48
48
|
* Returns "+04:00", "-05:00", or "Z" for UTC.
|
|
49
49
|
*/
|
|
50
50
|
declare function getLocalTimezoneOffset(): string;
|
|
51
51
|
|
|
52
|
-
export { clampTimestamp, createClientTimestamp, createServerTimestamp, extractTimezoneOffset,
|
|
52
|
+
export { clampTimestamp, createClientTimestamp, createServerTimestamp, extractTimezoneOffset, formatDateWithOffset, getLocalTimezoneOffset, parseTimestamp, timestampDiff };
|
package/dist/utils/dates.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../chunk-IZ2YBCUP.js";
|
|
2
2
|
function createClientTimestamp() {
|
|
3
3
|
const now = /* @__PURE__ */ new Date();
|
|
4
|
-
return
|
|
4
|
+
return formatDateWithOffset(now, getLocalTimezoneOffset());
|
|
5
5
|
}
|
|
6
6
|
function createServerTimestamp() {
|
|
7
7
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -23,9 +23,9 @@ function clampTimestamp(timestamp, limit) {
|
|
|
23
23
|
return timestamp;
|
|
24
24
|
}
|
|
25
25
|
const offset = extractTimezoneOffset(timestamp);
|
|
26
|
-
return
|
|
26
|
+
return formatDateWithOffset(limitDate, offset);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function formatDateWithOffset(date, offset) {
|
|
29
29
|
if (offset === "Z") {
|
|
30
30
|
return date.toISOString();
|
|
31
31
|
}
|
|
@@ -50,7 +50,7 @@ export {
|
|
|
50
50
|
createClientTimestamp,
|
|
51
51
|
createServerTimestamp,
|
|
52
52
|
extractTimezoneOffset,
|
|
53
|
-
|
|
53
|
+
formatDateWithOffset,
|
|
54
54
|
getLocalTimezoneOffset,
|
|
55
55
|
parseTimestamp,
|
|
56
56
|
timestampDiff
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dabble/patches",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Immutable JSON Patch implementation based on RFC 6902 supporting operational transformation and last-writer-wins",
|
|
5
5
|
"author": "Jacob Wright <jacwright@gmail.com>",
|
|
6
6
|
"bugs": {
|