File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
packages/website/docs/.vitepress/theme/components/Examples/BlockNote Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -39,14 +39,27 @@ const getRandomElement = (list: any[]) =>
39
39
const getRandomColor = ( ) => getRandomElement ( colors ) ;
40
40
const getRandomName = ( ) => getRandomElement ( names ) ;
41
41
42
+ function getUTCDateYYYYMMDD ( ) {
43
+ const now = new Date ( ) ;
44
+ const year = now . getUTCFullYear ( ) ;
45
+ const month = now . getUTCMonth ( ) + 1 ; // January is 0
46
+ const day = now . getUTCDate ( ) ;
47
+
48
+ // Add leading zeros to month and day if needed
49
+ const formattedMonth = month < 10 ? `0${ month } ` : `${ month } ` ;
50
+ const formattedDay = day < 10 ? `0${ day } ` : `${ day } ` ;
51
+
52
+ return `${ year } ${ formattedMonth } ${ formattedDay } ` ;
53
+ }
54
+
42
55
export function ReactBlockNote ( props : { theme : "light" | "dark" } ) {
43
56
const [ doc , provider ] = useMemo ( ( ) => {
44
57
console . log ( "create" ) ;
45
58
const doc = new Y . Doc ( ) ;
46
59
const provider = new YPartyKitProvider (
47
60
"blocknote.yousefed.partykit.dev" ,
48
61
// "127.0.0.1:1999", // (dev server)
49
- "homepage-2" ,
62
+ "homepage-" + getUTCDateYYYYMMDD ( ) ,
50
63
doc
51
64
) ;
52
65
return [ doc , provider ] ;
You can’t perform that action at this time.
0 commit comments