<commit_before>import { h, Component } from 'preact/preact';
import SVGIcon 			from 'com/svg-icon/icon';

export default class SidebarCalendar extends Component {
	constructor() {
		this.rows = 3;
		this.columns = 7;

		this.genCalendar( new Date() );
	}

	genCalendar( today ) {
		// TODO: Adjust noted days based on timezone
		// TODO: Adjust selected day/week when time itself rolls over

		let thisDay = today.getDate();
		let thisMonth = today.getMonth()+1;
		let thisYear = today.getFullYear();
		
		/* Months and Weeks start at 0. Years and Days start at 1. Using 0th day is like -1 */
		let monthEndsOn = new Date(today.getFullYear(), today.getMonth()+1, 0).getDate();
		let nextDay = today.getDate() - today.getDay();
		
		if ( nextDay < 1 ) {
			let lastMonth = new Date(today.getFullYear(),today.getMonth(),0);
			monthEndsOn = lastMonth.getDate();
			console.log( lastMonth.getFullYear(), lastMonth.getMonth(), lastMonth.getDate(), lastMonth.getDay() );
			nextDay = lastMonth.getDate() - lastMonth.getDay();
		}
		
		this.data = Array(...Array(this.rows)).map(() => Array.from( Array(this.columns),function(){
			let ret = {
				'year': thisYear,
				'month': thisMonth,
				'day': nextDay
			};
			
			if ( nextDay === thisDay ) {
				ret['selected'] = true;
			}
			
			nextDay++;
			if ( nextDay > monthEndsOn ) {
				nextDay -= monthEndsOn;
				thisMonth++;
				if ( thisMonth > 12 ) {<commit_msg>Fixed the Calendar Issue #314<commit_after>import { h, Component } from 'preact/preact';
import SVGIcon 			from 'com/svg-icon/icon';

export default class SidebarCalendar extends Component {
	constructor() {
		this.rows = 3;
		this.columns = 7;

		this.genCalendar( new Date() );
	}

	genCalendar( today ) {
		// TODO: Adjust noted days based on timezone
		// TODO: Adjust selected day/week when time itself rolls over

		let thisDay = today.getDate();
		let thisMonth = today.getMonth();
		let thisYear = today.getFullYear();
		
		/* Months and Weeks start at 0. Years and Days start at 1. Using 0th day is like -1 */
		let monthEndsOn = new Date(today.getFullYear(), today.getMonth(), 0).getDate();
		let nextDay = today.getDate() - today.getDay();
		
		if ( nextDay < 1 ) {
			let lastMonth = new Date(today.getFullYear(),today.getMonth(),0);
			monthEndsOn = lastMonth.getDate();
			console.log( lastMonth.getFullYear(), lastMonth.getMonth(), lastMonth.getDate(), lastMonth.getDay() );
			nextDay = lastMonth.getDate() - lastMonth.getDay();
		}
		
		this.data = Array(...Array(this.rows)).map(() => Array.from( Array(this.columns),function(){
			let ret = {
				'year': thisYear,
				'month': thisMonth,
				'day': nextDay
			};
			
			if ( nextDay === thisDay ) {
				ret['selected'] = true;
			}
			
			nextDay++;
			if ( nextDay > monthEndsOn ) {
				nextDay -= monthEndsOn;
				thisMonth++;
				if ( thisMonth > 12 ) {
{'fraction_non_alphanumeric': 0.1482394366197183, 'fraction_numerical': 0.009507042253521126, 'mean_word_length': 3.2721804511278196, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3612909', 'n_tokens_mistral': 1101, 'n_tokens_neox': 923, 'n_words': 248}