fix: myriad feed updates
This commit is contained in:
parent
27f8268e2b
commit
393dc8d2b9
7 changed files with 35 additions and 16 deletions
|
@ -88,6 +88,25 @@ export default {
|
|||
oldPost: (date) => {
|
||||
return DateTime.now().diff(DateTime.fromJSDate(new Date(date)), 'years').years > 3;
|
||||
},
|
||||
stringToRFC822Date: (dateString) => {
|
||||
const addLeadingZero = (num) => {
|
||||
num = num.toString();
|
||||
while (num.length < 2) num = "0" + num;
|
||||
return num;
|
||||
}
|
||||
const dayStrings = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
||||
const monthStrings = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||
const timeStamp = Date.parse(dateString);
|
||||
const date = new Date(timeStamp);
|
||||
const day = dayStrings[date.getDay()];
|
||||
const dayNumber = addLeadingZero(date.getDate());
|
||||
const month = monthStrings[date.getMonth()];
|
||||
const year = date.getFullYear();
|
||||
const time = `${addLeadingZero(date.getHours())}:${addLeadingZero(date.getMinutes())}:00`;
|
||||
const timezone = date.getTimezoneOffset() === 0 ? "GMT" : "PT";
|
||||
|
||||
return `${day}, ${dayNumber} ${month} ${year} ${time} ${timezone}`;
|
||||
},
|
||||
|
||||
// links
|
||||
findPost: (url, posts) => {
|
||||
|
|
Reference in a new issue