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[]) =>
3939const getRandomColor = ( ) => getRandomElement ( colors ) ;
4040const getRandomName = ( ) => getRandomElement ( names ) ;
4141
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+
4255export function ReactBlockNote ( props : { theme : "light" | "dark" } ) {
4356 const [ doc , provider ] = useMemo ( ( ) => {
4457 console . log ( "create" ) ;
4558 const doc = new Y . Doc ( ) ;
4659 const provider = new YPartyKitProvider (
4760 "blocknote.yousefed.partykit.dev" ,
4861 // "127.0.0.1:1999", // (dev server)
49- "homepage-2" ,
62+ "homepage-" + getUTCDateYYYYMMDD ( ) ,
5063 doc
5164 ) ;
5265 return [ doc , provider ] ;
You can’t perform that action at this time.
0 commit comments