Added arn to the main repository

This commit is contained in:
2019-06-03 18:32:43 +09:00
parent cf258573a8
commit 29a48d94a5
465 changed files with 15968 additions and 288 deletions

43
arn/AiringDate.go Normal file
View File

@ -0,0 +1,43 @@
package arn
import (
"time"
)
// AiringDate represents the airing date of an anime.
type AiringDate struct {
Start string `json:"start" editable:"true"`
End string `json:"end" editable:"true"`
}
// StartDateHuman returns the start date of the anime in human readable form.
func (airing *AiringDate) StartDateHuman() string {
t, _ := time.Parse(time.RFC3339, airing.Start)
humanReadable := t.Format(time.RFC1123)
return humanReadable[:len("Thu, 25 May 2017")]
}
// EndDateHuman returns the end date of the anime in human readable form.
func (airing *AiringDate) EndDateHuman() string {
t, _ := time.Parse(time.RFC3339, airing.End)
humanReadable := t.Format(time.RFC1123)
return humanReadable[:len("Thu, 25 May 2017")]
}
// StartTimeHuman returns the start time of the anime in human readable form.
func (airing *AiringDate) StartTimeHuman() string {
t, _ := time.Parse(time.RFC3339, airing.Start)
humanReadable := t.Format(time.RFC1123)
return humanReadable[len("Thu, 25 May 2017 "):]
}
// EndTimeHuman returns the end time of the anime in human readable form.
func (airing *AiringDate) EndTimeHuman() string {
t, _ := time.Parse(time.RFC3339, airing.End)
humanReadable := t.Format(time.RFC1123)
return humanReadable[len("Thu, 25 May 2017 "):]
}