Add time to event og tags; modify date for sermon database
parent
13c50fb6ef
commit
9f738bc9ba
|
|
@ -80,9 +80,8 @@ exports.insertSermon = function(dateOrSermonObject, titleOrCallbackFunction, aut
|
||||||
insertSermonFromObject(dateOrSermonObject,titleOrCallbackFunction);
|
insertSermonFromObject(dateOrSermonObject,titleOrCallbackFunction);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//date string needs to be in the following format: yyyy-mm-dd-hh-mm
|
|
||||||
var str = dateOrSermonObject.split(/\D/);
|
dateOrSermonObject = new Date(dateOrSermonObject);
|
||||||
dateOrSermonObject = new Date(str[0],--str[1],str[2],str[3],str[4]);
|
|
||||||
connection.query("INSERT INTO Sermons (CreatedDate,ModifiedDate,Id,Date,Title,Author,Description,File) VALUES(?,CURRENT_TIMESTAMP,NULL,?,?,?,?,?)",[new Date,dateOrSermonObject,titleOrCallbackFunction,author,description,file],function(error,result){
|
connection.query("INSERT INTO Sermons (CreatedDate,ModifiedDate,Id,Date,Title,Author,Description,File) VALUES(?,CURRENT_TIMESTAMP,NULL,?,?,?,?,?)",[new Date,dateOrSermonObject,titleOrCallbackFunction,author,description,file],function(error,result){
|
||||||
if (error){
|
if (error){
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
@ -108,11 +107,7 @@ exports.updateSermon = function(sermonIdOrSermonObject, dateOrCallbackFunction,
|
||||||
updateSermonFromObject(sermonIdOrSermonObject,callback);
|
updateSermonFromObject(sermonIdOrSermonObject,callback);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof dateOrCallbackFunction != 'date'){
|
dateOrCallbackFunction = new Date(dateOrCallbackFunction);
|
||||||
//date string needs to be in the following format: yyyy-mm-dd-hh-mm
|
|
||||||
var str = dateOrCallbackFunction.split(/\D/);
|
|
||||||
dateOrCallbackFunction = new Date(str[0],--str[1],str[2],str[3],str[4]);
|
|
||||||
}
|
|
||||||
connection.query("UPDATE Sermons SET ModifiedDate = CURRENT_TIMESTAMP, Date = ?, Title = ?, Author = ?, Description = ? WHERE Id = ?",[dateOrCallbackFunction,title,author,description,sermonIdOrSermonObject],function(error,result){
|
connection.query("UPDATE Sermons SET ModifiedDate = CURRENT_TIMESTAMP, Date = ?, Title = ?, Author = ?, Description = ? WHERE Id = ?",[dateOrCallbackFunction,title,author,description,sermonIdOrSermonObject],function(error,result){
|
||||||
if (error){
|
if (error){
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,10 @@ function getEventMeta(req, res, id){
|
||||||
var monthNum = event.startDate.getMonth();
|
var monthNum = event.startDate.getMonth();
|
||||||
var monthName = MONTHS_FULL[monthNum];
|
var monthName = MONTHS_FULL[monthNum];
|
||||||
var day = event.startDate.getDate();
|
var day = event.startDate.getDate();
|
||||||
|
var year = event.startDate.getYear();
|
||||||
|
var hour = event.startDate.getUTCHours();
|
||||||
|
var minutes = event.startDate.getUTCMinutes();
|
||||||
|
|
||||||
|
|
||||||
var port = req.socket.localPort;
|
var port = req.socket.localPort;
|
||||||
var imageUrl = req.protocol + "://" + req.hostname + calendarImageUrl + monthName + "/" + day;
|
var imageUrl = req.protocol + "://" + req.hostname + calendarImageUrl + monthName + "/" + day;
|
||||||
|
|
@ -114,7 +118,7 @@ function getEventMeta(req, res, id){
|
||||||
Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
|
Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
|
||||||
<meta property="og:url" content="`+ evntUrl +`"/>
|
<meta property="og:url" content="`+ evntUrl +`"/>
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:title" content="` + event.title + `" />
|
<meta property="og:title" content="` + event.title + ` | ` + hour + `:` + minutes + `" />
|
||||||
<meta property="og:description" content="` + event.description + `" />
|
<meta property="og:description" content="` + event.description + `" />
|
||||||
<meta property="og:image" content="` + imageUrl + `"/>
|
<meta property="og:image" content="` + imageUrl + `"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue