<commit_before>//pass a string as a parameter , and it will check to see whether that string contains either a unix timestamp or a natural language date (example: January 1, 2016)
//If it does, it returns both the Unix timestamp and the natural language form of that date
//If it does not contain a date or Unix timestamp, it returns null for those properties.

//need to set up jade or handlebars



var express = require('express');


var app = express();

app.set('view engine', 'jade');

app.set('port', process.env.PORT || 8080);

app.get('/', function(req, res){
    res.render('main');
});

var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var year, monthNumber, month, day, unix;        

app.get('/:date', function(req, res){
    

    
    function isNatural(enteredDate) {
        year = enteredDate.getFullYear();
        monthNumber = enteredDate.getMonth();
        month = monthNames[monthNumber];
        day = enteredDate.getDate();
        unix = enteredDate.getTime();
        
        return '{"unix":' + unix.toString().slice(0,-3) + ',"natural":' + '"' + month + ' ' + day + ', ' + year + '"}';
    }
    
    function isUnix(enteredDate) {
        year = enteredDate.getFullYear();
        monthNumber = enteredDate.getMonth();
        month = monthNames[monthNumber];
        day = enteredDate.getDate();
        unix = enteredDate.getTime();
        
        return '{"unix":' + unix.toString().slice(0,-3) + ',"natural":' + '"' + month + ' ' + day + ', ' + year + '"}';
    }
    
    
    var enteredDateString = new Date(req.params.date);
    var enteredDateNumber = new Date(Number(req.params.date) * 1000);
    
    if (enteredDateString == 'Invalid Date'){
        if (enteredDateNumber == 'Invalid Date'){
            res.end('{"unix":null,"natural":null}');
        }
        else {
            res.end(isUnix(enteredDateNumber));
        }
    }
    else {
        res.end(isNatural(enteredDateString));
    }
    
    
    
    
    

});


app.listen(app.get('port'), function() {
    console.log('Express started on http://localhost:' + app.get('port') + '; press Ctrl-C to terminate.');
});<commit_msg>changed port<commit_after>//pass a string as a parameter , and it will check to see whether that string contains either a unix timestamp or a natural language date (example: January 1, 2016)
//If it does, it returns both the Unix timestamp and the natural language form of that date
//If it does not contain a date or Unix timestamp, it returns null for those properties.

//need to set up jade or handlebars



var express = require('express');


var app = express();

app.set('view engine', 'jade');

app.get('/', function(req, res){
    res.render('main');
});

var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var year, monthNumber, month, day, unix;        

app.get('/:date', function(req, res){
    

    
    function isNatural(enteredDate) {
        year = enteredDate.getFullYear();
        monthNumber = enteredDate.getMonth();
        month = monthNames[monthNumber];
        day = enteredDate.getDate();
        unix = enteredDate.getTime();
        
        return '{"unix":' + unix.toString().slice(0,-3) + ',"natural":' + '"' + month + ' ' + day + ', ' + year + '"}';
    }
    
    function isUnix(enteredDate) {
        year = enteredDate.getFullYear();
        monthNumber = enteredDate.getMonth();
        month = monthNames[monthNumber];
        day = enteredDate.getDate();
        unix = enteredDate.getTime();
        
        return '{"unix":' + unix.toString().slice(0,-3) + ',"natural":' + '"' + month + ' ' + day + ', ' + year + '"}';
    }
    
    
    var enteredDateString = new Date(req.params.date);
    var enteredDateNumber = new Date(Number(req.params.date) * 1000);
    
    if (enteredDateString == 'Invalid Date'){
        if (enteredDateNumber == 'Invalid Date'){
            res.end('{"unix":null,"natural":null}');
        }
        else {
            res.end(isUnix(enteredDateNumber));
        }
    }
    else {
        res.end(isNatural(enteredDateString));
    }
    
    
    
    
    

});


app.listen(process.env.PORT || 3000, function() {
    console.log('Express started on http://localhost:' + app.get('port') + '; press Ctrl-C to terminate.');
});
{'fraction_non_alphanumeric': 0.16169828364950317, 'fraction_numerical': 0.0076784101174345075, 'mean_word_length': 2.72497897392767, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, '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': '1591349', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1318, 'n_words': 357}