Fix for album release info

This commit is contained in:
gballan1 2016-11-29 12:06:26 -05:00
parent daeaed4ba9
commit 6f879004fc
2 changed files with 18 additions and 2 deletions

View File

@ -20,7 +20,7 @@ class Album extends Eloquent {
} }
public function releaseDate() { public function releaseDate() {
return date('F jS, Y', strtotime($this->release_date)); return date('F j, Y', strtotime($this->release_date));
} }
public function releaseYear() { public function releaseYear() {

View File

@ -46,12 +46,28 @@ function getAlbumInfo(albumElem) {
// change album title // change album title
$('#album-title').text(json.title); $('#album-title').text(json.title);
// change album release date // 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 // change album description
$('#album-description').text(json.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) { function getAlbumSongs(albumElem) {
albumElem = $(albumElem).parent(); albumElem = $(albumElem).parent();