mirror of
https://github.com/stashapp/stash.git
synced 2025-12-07 08:54:10 +01:00
* Treat empty image input as null * Add validation to models.Date * Allow zero dates in database * Make scene_markers.scene_id non-nullable * Drop scraped_items table * Remove movie/studio checksum * Add migration notes --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
27 lines
496 B
Go
27 lines
496 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/stashapp/stash/pkg/utils"
|
|
)
|
|
|
|
// Date wraps a time.Time with a format of "YYYY-MM-DD"
|
|
type Date struct {
|
|
time.Time
|
|
}
|
|
|
|
const dateFormat = "2006-01-02"
|
|
|
|
func (d Date) String() string {
|
|
return d.Format(dateFormat)
|
|
}
|
|
|
|
// ParseDate uses utils.ParseDateStringAsTime to parse a string into a date.
|
|
func ParseDate(s string) (Date, error) {
|
|
ret, err := utils.ParseDateStringAsTime(s)
|
|
if err != nil {
|
|
return Date{}, err
|
|
}
|
|
return Date{Time: ret}, nil
|
|
}
|