Fix for album release info
This commit is contained in:
parent
daeaed4ba9
commit
6f879004fc
@ -20,7 +20,7 @@ class Album extends Eloquent {
|
||||
}
|
||||
|
||||
public function releaseDate() {
|
||||
return date('F jS, Y', strtotime($this->release_date));
|
||||
return date('F j, Y', strtotime($this->release_date));
|
||||
}
|
||||
|
||||
public function releaseYear() {
|
||||
|
@ -46,12 +46,28 @@ function getAlbumInfo(albumElem) {
|
||||
// change album title
|
||||
$('#album-title').text(json.title);
|
||||
// change album release date
|
||||
$('#album-release span').text(new Date(json.release_date, "January 25 2015"));
|
||||
$('#album-release span').text(formatReleaseDate(json.release_date));
|
||||
// change album description
|
||||
$('#album-description').text(json.description);
|
||||
});
|
||||
}
|
||||
|
||||
function formatReleaseDate(d) {
|
||||
var monthNames = [
|
||||
"January", "February", "March",
|
||||
"April", "May", "June", "July",
|
||||
"August", "September", "October",
|
||||
"November", "December"
|
||||
];
|
||||
|
||||
var date = new Date(d);
|
||||
var day = date.getDate();
|
||||
var monthIndex = date.getMonth();
|
||||
var year = date.getFullYear();
|
||||
|
||||
return monthNames[monthIndex] + ' ' + day + ', ' + year;
|
||||
}
|
||||
|
||||
function getAlbumSongs(albumElem) {
|
||||
albumElem = $(albumElem).parent();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user