mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	enhance(backend): MFMのunixtimeをISO形式で連合するように
This commit is contained in:
		
							parent
							
								
									5f5712a3ee
								
							
						
					
					
						commit
						4b3f9bd9a6
					
				
					 1 changed files with 12 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -276,9 +276,18 @@ export class MfmService {
 | 
			
		|||
			},
 | 
			
		||||
 | 
			
		||||
			fn: (node) => {
 | 
			
		||||
				const el = doc.createElement('i');
 | 
			
		||||
				appendChildren(node.children, el);
 | 
			
		||||
				return el;
 | 
			
		||||
				if (node.props.name === 'unixtime') {
 | 
			
		||||
					const text = node.children[0]!.type === 'text' ? node.children[0].props.text : '';
 | 
			
		||||
					const date = new Date(parseInt(text, 10) * 1000);
 | 
			
		||||
					const el = doc.createElement('time');
 | 
			
		||||
					el.setAttribute('datetime', date.toISOString());
 | 
			
		||||
					el.textContent = date.toISOString();
 | 
			
		||||
					return el;
 | 
			
		||||
				} else {
 | 
			
		||||
					const el = doc.createElement('i');
 | 
			
		||||
					appendChildren(node.children, el);
 | 
			
		||||
					return el;
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
 | 
			
		||||
			blockCode: (node) => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue