chore: formatting
This commit is contained in:
parent
b5dd77918e
commit
faefcbf604
5 changed files with 24 additions and 24 deletions
|
@ -13,25 +13,25 @@ export default {
|
|||
return [year, month, day].join(separator)
|
||||
},
|
||||
oldPost: (date) => {
|
||||
return DateTime.now().diff(DateTime.fromJSDate(new Date(date)), 'years').years > 3;
|
||||
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;
|
||||
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";
|
||||
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}`;
|
||||
return `${day}, ${dayNumber} ${month} ${year} ${time} ${timezone}`
|
||||
}
|
||||
}
|
|
@ -60,8 +60,8 @@ export default {
|
|||
bookStatus: (books, status) => books.filter(book => book.status === status),
|
||||
bookFavorites: (books) => books.filter(book => book.favorite === true),
|
||||
bookYearLinks: (years) => years.sort((a, b) => b.value - a.value).map((year, index) => {
|
||||
const separator = index < years.length - 1 ? ' / ' : '';
|
||||
return `<a href="/books/years/${year.value}">${year.value}</a>${separator}`;
|
||||
const separator = index < years.length - 1 ? ' / ' : ''
|
||||
return `<a href="/books/years/${year.value}">${year.value}</a>${separator}`
|
||||
}).join(''),
|
||||
bookSortDescending: (books) => books.filter(book => !isNaN(DateTime.fromISO(book.date).toMillis())).sort((a, b) => {
|
||||
const dateA = DateTime.fromISO(a.date)
|
||||
|
|
Reference in a new issue