tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
store original timezone in date fact
awarm.space
1 year ago
6d684de2
3a649e8d
+13
-3
2 changed files
expand all
collapse all
unified
split
components
Blocks
DateTimeBlock.tsx
src
replicache
attributes.ts
+12
-3
components/Blocks/DateTimeBlock.tsx
···
44
44
type: "date-time",
45
45
value: newSelectedDate.toISOString(),
46
46
dateOnly: dateFact?.data.dateOnly,
47
47
+
originalTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
47
48
},
48
49
attribute: "block/date-time",
49
50
});
···
56
57
rep?.mutate.assertFact({
57
58
entity: props.entityID,
58
59
data: {
60
60
+
originalTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
59
61
type: "date-time",
60
62
value: date.toISOString(),
61
63
dateOnly: dateFact?.data.dateOnly,
···
77
79
78
80
rep?.mutate.assertFact({
79
81
entity: props.entityID,
80
80
-
data: { type: "date-time", value: newDate.toISOString() },
82
82
+
data: {
83
83
+
type: "date-time",
84
84
+
value: newDate.toISOString(),
85
85
+
86
86
+
originalTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
87
87
+
dateOnly: dateFact?.data.dateOnly,
88
88
+
},
81
89
attribute: "block/date-time",
82
90
});
83
91
};
···
155
163
<Checkbox
156
164
checked={!!dateFact?.data.dateOnly}
157
165
onChange={(e) => {
158
158
-
if (!dateFact) return;
159
166
rep?.mutate.assertFact({
160
167
entity: props.entityID,
161
168
data: {
162
169
type: "date-time",
163
163
-
value: dateFact.data.value,
170
170
+
value: new Date().toISOString(),
171
171
+
originalTimezone:
172
172
+
Intl.DateTimeFormat().resolvedOptions().timeZone,
164
173
dateOnly: e.currentTarget.checked,
165
174
},
166
175
attribute: "block/date-time",
+1
src/replicache/attributes.ts
···
199
199
"date-time": {
200
200
type: "date-time";
201
201
value: string;
202
202
+
originalTimezone: string;
202
203
dateOnly?: boolean;
203
204
};
204
205
"ordered-reference": {