Uses atcute to show how you can do upserts with atproto records

tid example

+8 -7
+8 -7
tid.js
··· 3 3 const rightMeow = new Date(); 4 4 console.log(`It's ${rightMeow.toLocaleString()} or ${rightMeow.getTime()}`); 5 5 6 - //Tids timestamps are in microseconds. Padding it a bit since we don't need that precision. 6 + //TIDs timestamps are in microseconds. Padding it a bit since we don't need that precision. 7 7 const rightNowMicroSeconds = rightMeow * 1000; 8 8 //Every TID needs a clock id, can be your favorite number even. 9 9 const clockId = 23; 10 10 11 - const rightMeowTid = TID.create(rightNowMicroSeconds, clockId) 12 - console.log(`TID: ${rightMeowTid}`) 13 - const { timestamp} = TID.parse(rightMeowTid) 11 + const rightMeowTid = TID.create(rightNowMicroSeconds, clockId); 12 + console.log(`TID: ${rightMeowTid}`); 13 + const { timestamp} = TID.parse(rightMeowTid); 14 14 15 15 //remove the padding 16 - const backToMilliSeconds = timestamp / 1000 17 - const rightNowConvertedBack = new Date(backToMilliSeconds) 18 - console.log(`Converted back: ${rightNowConvertedBack.toLocaleString()} or ${backToMilliSeconds}`) 16 + const backToMilliSeconds = timestamp / 1000; 17 + //Get a readable timestamp for demo 18 + const rightNowConvertedBack = new Date(backToMilliSeconds); 19 + console.log(`Converted back: ${rightNowConvertedBack.toLocaleString()} or ${backToMilliSeconds}`);