<commit_before>import { Component, OnInit } from '@angular/core';
import { Storage } from '../../_storage/storage.service';
import { SharedService } from '../../_shared/shared.service';
import * as moment from 'moment';

@Component({
  selector: 'tab-date',
  templateUrl: 'date.component.html',
  host: {'class': 'date'}
})
export class TabDateComponent implements OnInit {
  currentDate: Date;

  constructor(
    public shared: SharedService,
    public settings: Storage
  ) {}

  ngOnInit() {
    if (this.settings.config.date.enabled) {
      this.shared.zoneGuess = moment.tz.guess();
      setInterval(() => {
        this.currentDate = new Date();
        this.setTitleDate();
      }, 500);
    }
  }

  setTitleDate() {
    if (
      this.settings.config.title.type === 20 ||
      this.settings.config.title.type === 40 ||
      this.settings.config.title.type === 50
    ) {
      this.shared.date = this.getDate();
    }
  }

  getDate(): string {
    moment.locale(this.settings.config.lang);
    let current = this.currentDate;
    let c = this.settings.config.date;
    let zone = this.getZone(c.timezone);
    let date = moment(current).tz(zone);
    let year = c.year.twoDigit ? date.format('YY') : date.format('YYYY');
    let month = c.month.abbr ? date.format('MMM') : date.format('MMMM');
    let day = c.day.twoDigit ? date.format('DD') : date.format('D');
    let weekDay: string;
    if (c.dayOfWeek.enabled) {
      weekDay = c.dayOfWeek.abbr ? date.format('ddd') + ', ' : date.format('dddd') + ', ';
    } else {
      weekDay = '';
    }
    let delimiter = c.short.delimiter;
    if (c.short.enabled) {
      month = date.format('M');
      if (c.format === 10) {
        if (c.year.enabled && c.month.enabled && c.day.enabled) {
          return weekDay + day + delimiter + month + delimiter + year;
        } else if (!c.year.enabled && !c.month.enabled && c.day.enabled) {
          return weekDay + day;
        } else if (!c.year.enabled && c.month.enabled && c.day.enabled) {
          return weekDay + day + delimiter + month;
        } else if (c.year.enabled && !c.month.enabled && c.day.enabled) {
          return weekDay + day + delimiter + year;
        } else if (!c.year.enabled && c.month.enabled && c.day.enabled) {
          return weekDay + month;
        } else if (c.year.enabled && c.month.enabled && !c.day.enabled) {
          return weekDay + month + delimiter + year;
        } else if (c.year.enabled && !c.month.enabled && !c.day.enabled) {<commit_msg>#142 Two digit month not showing two digits<commit_after>import { Component, OnInit } from '@angular/core';
import { Storage } from '../../_storage/storage.service';
import { SharedService } from '../../_shared/shared.service';
import * as moment from 'moment';

@Component({
  selector: 'tab-date',
  templateUrl: 'date.component.html',
  host: {'class': 'date'}
})
export class TabDateComponent implements OnInit {
  currentDate: Date;

  constructor(
    public shared: SharedService,
    public settings: Storage
  ) {}

  ngOnInit() {
    if (this.settings.config.date.enabled) {
      this.shared.zoneGuess = moment.tz.guess();
      setInterval(() => {
        this.currentDate = new Date();
        this.setTitleDate();
      }, 500);
    }
  }

  setTitleDate() {
    if (
      this.settings.config.title.type === 20 ||
      this.settings.config.title.type === 40 ||
      this.settings.config.title.type === 50
    ) {
      this.shared.date = this.getDate();
    }
  }

  getDate(): string {
    moment.locale(this.settings.config.lang);
    let current = this.currentDate;
    let c = this.settings.config.date;
    let zone = this.getZone(c.timezone);
    let date = moment(current).tz(zone);
    let year = c.year.twoDigit ? date.format('YY') : date.format('YYYY');
    let month = c.month.abbr ? date.format('MMM') : date.format('MMMM');
    let day = c.day.twoDigit ? date.format('DD') : date.format('D');
    let weekDay: string;
    if (c.dayOfWeek.enabled) {
      weekDay = c.dayOfWeek.abbr ? date.format('ddd') + ', ' : date.format('dddd') + ', ';
    } else {
      weekDay = '';
    }
    let delimiter = c.short.delimiter;
    if (c.short.enabled) {
      month = c.month.twoDigit ? date.format('MM') : date.format('M');
      if (c.format === 10) {
        if (c.year.enabled && c.month.enabled && c.day.enabled) {
          return weekDay + day + delimiter + month + delimiter + year;
        } else if (!c.year.enabled && !c.month.enabled && c.day.enabled) {
          return weekDay + day;
        } else if (!c.year.enabled && c.month.enabled && c.day.enabled) {
          return weekDay + day + delimiter + month;
        } else if (c.year.enabled && !c.month.enabled && c.day.enabled) {
          return weekDay + day + delimiter + year;
        } else if (!c.year.enabled && c.month.enabled && c.day.enabled) {
          return weekDay + month;
        } else if (c.year.enabled && c.month.enabled && !c.day.enabled) {
          return weekDay + month + delimiter + year;
        } else if (c.year.enabled && !c.month.enabled && !c.day.enabled) {
{'fraction_non_alphanumeric': 0.16774700451777647, 'fraction_numerical': 0.004910626595953644, 'mean_word_length': 2.5336571825121443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7039574', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1637, 'n_words': 357}