<commit_before>import { h, Component } 				from 'preact/preact';
import { shallowDiff }	 				from 'shallow-compare/index';

import NavLink							from 'com/nav-link/link';

export default class ContentCommonBodyBy extends Component {
	constructor( props ) {
		super(props);
	}

	shouldComponentUpdate( nextProps ) {
		return shallowDiff(this.props.children, nextProps.children);
	}
	
	getName( node ) {
		if ( node.meta['real-name'] )
			return node.meta['real-name'];
		return node.name;
	}

	getAtName( node ) {
		return node.name;
	}

	getURL( node ) {
		return '/users/'+node.slug;
	}
	
	getWhen( node ) {
		var date_pub = new Date(node.published);
		var date_now = new Date();
		var pub_diff = (date_now.getTime() - date_pub.getTime());// - (date_now.getTimezoneOffset()*60);
		
		// x minutes ago
		return <span title={getLocaleDate(date_pub)}>{getRoughAge(pub_diff)}</span>;
	}
	getModified( node ) {
		var date_pub = new Date(node.modified);
		var date_now = new Date();
		var pub_diff = (date_now.getTime() - date_pub.getTime());// - (date_now.getTimezoneOffset()*60);
		
		// x minutes ago
		return <span title={getLocaleDate(date_pub)}>{getRoughAge(pub_diff)}</span>;
	}

	render( props ) {
		props.class = typeof props.class == 'string' ? props.class.split(' ') : [];
		props.class.push("content-common-body");
		props.class.push("-by");
		
		var Body = [];
		if ( props.author ) {
			Body.push(<span class="-name">by {this.getName(props.author)}</span>);
			Body.push(<span> (<NavLink class="-at-name" href={this.getURL(props.author)}>@{this.getAtName(props.author)}</NavLink>)</span>);
		}
		if ( props.when && props.node ) {
			Body.push(<span class="-when">{Body.length ? ', ' : ''}{props.label} {this.getWhen(props.node)}</span>);
		}
		else if ( props.modified && props.node ) {
			Body.push(<span class="-when">{Body.length ? ', ' : ''}{props.label} {this.getModified(props.node)}</span>);
		}
		
		return <div class={props.class}>{Body}{props.children}</div>;
	}
}
<commit_msg>can now assign a date beyond beyond the publish date<commit_after>import { h, Component } 				from 'preact/preact';
import { shallowDiff }	 				from 'shallow-compare/index';

import NavLink							from 'com/nav-link/link';

export default class ContentCommonBodyBy extends Component {
	constructor( props ) {
		super(props);
	}

	shouldComponentUpdate( nextProps ) {
		return shallowDiff(this.props.children, nextProps.children);
	}
	
	getName( node ) {
		if ( node.meta['real-name'] )
			return node.meta['real-name'];
		return node.name;
	}

	getAtName( node ) {
		return node.name;
	}

	getURL( node ) {
		return '/users/'+node.slug;
	}
	
	getWhen( node ) {
		var date_pub = new Date(node.published);
		if ( node.meta['origin-date'] ) {
			date_pub = new Date(node.meta['origin-date']);
		}
		var date_now = new Date();
		var pub_diff = (date_now.getTime() - date_pub.getTime());// - (date_now.getTimezoneOffset()*60);
		
		// x minutes ago
		return <span title={getLocaleDate(date_pub)}>{getRoughAge(pub_diff)}</span>;
	}
	getModified( node ) {
		var date_pub = new Date(node.modified);
		var date_now = new Date();
		var pub_diff = (date_now.getTime() - date_pub.getTime());// - (date_now.getTimezoneOffset()*60);
		
		// x minutes ago
		return <span title={getLocaleDate(date_pub)}>{getRoughAge(pub_diff)}</span>;
	}

	render( props ) {
		props.class = typeof props.class == 'string' ? props.class.split(' ') : [];
		props.class.push("content-common-body");
		props.class.push("-by");
		
		var Body = [];
		if ( props.author ) {
			Body.push(<span class="-name">by {this.getName(props.author)}</span>);
			Body.push(<span> (<NavLink class="-at-name" href={this.getURL(props.author)}>@{this.getAtName(props.author)}</NavLink>)</span>);
		}
		if ( props.when && props.node ) {
			Body.push(<span class="-when">{Body.length ? ', ' : ''}{props.label} {this.getWhen(props.node)}</span>);
		}
		else if ( props.modified && props.node ) {
			Body.push(<span class="-when">{Body.length ? ', ' : ''}{props.label} {this.getModified(props.node)}</span>);
		}
		
		return <div class={props.class}>{Body}{props.children}</div>;
	}
}

{'fraction_non_alphanumeric': 0.1892744479495268, 'fraction_numerical': 0.001941276389225916, 'mean_word_length': 3.889679715302491, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '355778', 'n_tokens_mistral': 1594, 'n_tokens_neox': 1443, 'n_words': 260}