mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-30 17:56:31 +02:00
Fix time, it actually uses the RFC now
This commit is contained in:
parent
c19a4b1e60
commit
d0e4ccb681
@ -1,5 +1,4 @@
|
||||
package curseforge
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
@ -8,7 +7,6 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -147,31 +145,14 @@ func getModInfo(modID int) (modInfo, error) {
|
||||
return infoRes, nil
|
||||
}
|
||||
|
||||
const cfDateFormatString = "2006-01-02T15:04:05.999"
|
||||
|
||||
type cfDateFormat struct {
|
||||
time.Time
|
||||
}
|
||||
|
||||
func (f *cfDateFormat) UnmarshalJSON(input []byte) error {
|
||||
trimmed := strings.Trim(string(input), `"`)
|
||||
time, err := time.Parse(cfDateFormatString, trimmed)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
f.Time = time
|
||||
return nil
|
||||
}
|
||||
|
||||
// modFileInfo is a subset of the deserialised JSON response from the Curse API for mod files
|
||||
type modFileInfo struct {
|
||||
ID int `json:"id"`
|
||||
FileName string `json:"fileNameOnDisk"`
|
||||
FriendlyName string `json:"fileName"`
|
||||
Date cfDateFormat `json:"fileDate"`
|
||||
Length int `json:"fileLength"`
|
||||
FileType int `json:"releaseType"`
|
||||
ID int `json:"id"`
|
||||
FileName string `json:"fileNameOnDisk"`
|
||||
FriendlyName string `json:"fileName"`
|
||||
Date time.Time `json:"fileDate"`
|
||||
Length int `json:"fileLength"`
|
||||
FileType int `json:"releaseType"`
|
||||
// fileStatus? means latest/preferred?
|
||||
DownloadURL string `json:"downloadUrl"`
|
||||
GameVersions []string `json:"gameVersion"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user