<commit_before>import { nls } from './nls';

export class DateService {
    private static _local: string;
    public get locale() {
        return DateService._local || 'en-US';
    }
    public set locale(val: string) {
        if (!nls.checkExists(val)) {
            throw 'Locale not recognized as a valid value. Only en-US/he-IL/ru-RU/pt-BR/de avaliable';
        }
        DateService._local = val;
    }
    constructor() {
    }
    // private locale = ((<any>window).navigator['userLanguage'] || window.navigator.language).toLowerCase();

    public getDaysOfWeek() {
        return nls.getWeekdays(this.locale);
    }
    public getMonths() {
        return nls.getMonths(this.locale);
    }
    public getYears() {
        let years: Array<any> = [];
        for (var i = 1900; i < 2101; i++) years.push(i);
        return years;
    }
    public createDateList(currentDate: Date) {
        let firstDay = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1).getDate();
        let lastDay = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0).getDate()
        let dateList: Date[] = [];

        for (var i = firstDay; i <= lastDay; i++) {
            dateList.push(new Date(currentDate.getFullYear(), currentDate.getMonth(), i));
        }

        firstDay = dateList[0].getDay();
        // for (var j = 0; j < firstDay; j++) {
        //     dateList.unshift(undefined);
        // }
        return dateList;
    }
}<commit_msg>fix(calendar): add placeholder days at start of calendar so dates align with weekdays<commit_after>import { nls } from './nls';

export class DateService {
    private static _local: string;
    public get locale() {
        return DateService._local || 'en-US';
    }
    public set locale(val: string) {
        if (!nls.checkExists(val)) {
            throw 'Locale not recognized as a valid value. Only en-US/he-IL/ru-RU/pt-BR/de avaliable';
        }
        DateService._local = val;
    }
    constructor() {
    }
    // private locale = ((<any>window).navigator['userLanguage'] || window.navigator.language).toLowerCase();

    public getDaysOfWeek() {
        return nls.getWeekdays(this.locale);
    }
    public getMonths() {
        return nls.getMonths(this.locale);
    }
    public getYears() {
        let years: Array<any> = [];
        for (var i = 1900; i < 2101; i++) years.push(i);
        return years;
    }
    public createDateList(currentDate: Date) {
        let firstDay = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1).getDate();
        let lastDay = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0).getDate();
        let dateList: Date[] = [];

        for (var i = firstDay; i <= lastDay; i++) {
            dateList.push(new Date(currentDate.getFullYear(), currentDate.getMonth(), i));
        }

        for (var j = 0; j < firstDay; j++) {
            dateList.unshift(undefined);
        }
        return dateList;
    }
}
{'fraction_non_alphanumeric': 0.1426644182124789, 'fraction_numerical': 0.008431703204047217, 'mean_word_length': 2.3858447488584473, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, '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': '6943344', 'n_tokens_mistral': 932, 'n_tokens_neox': 900, 'n_words': 222}