a tool for shared writing and social publishing

store original timezone in date fact

+13 -3
+12 -3
components/Blocks/DateTimeBlock.tsx
··· 44 44 type: "date-time", 45 45 value: newSelectedDate.toISOString(), 46 46 dateOnly: dateFact?.data.dateOnly, 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 + 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 - data: { type: "date-time", value: newDate.toISOString() }, 82 + data: { 83 + type: "date-time", 84 + value: newDate.toISOString(), 85 + 86 + originalTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, 87 + dateOnly: dateFact?.data.dateOnly, 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 - if (!dateFact) return; 159 166 rep?.mutate.assertFact({ 160 167 entity: props.entityID, 161 168 data: { 162 169 type: "date-time", 163 - value: dateFact.data.value, 170 + value: new Date().toISOString(), 171 + originalTimezone: 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 + originalTimezone: string; 202 203 dateOnly?: boolean; 203 204 }; 204 205 "ordered-reference": {