mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Add partial import functionality (#812)
This commit is contained in:
@@ -2,11 +2,14 @@ package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
)
|
||||
|
||||
var currentLocation = time.Now().Location()
|
||||
|
||||
type JSONTime struct {
|
||||
time.Time
|
||||
}
|
||||
@@ -28,3 +31,19 @@ func (jt *JSONTime) MarshalJSON() ([]byte, error) {
|
||||
}
|
||||
return []byte(fmt.Sprintf("\"%s\"", jt.Time.Format(time.RFC3339))), nil
|
||||
}
|
||||
|
||||
func (jt JSONTime) GetTime() time.Time {
|
||||
if currentLocation != nil {
|
||||
if jt.IsZero() {
|
||||
return time.Now().In(currentLocation)
|
||||
} else {
|
||||
return jt.Time.In(currentLocation)
|
||||
}
|
||||
} else {
|
||||
if jt.IsZero() {
|
||||
return time.Now()
|
||||
} else {
|
||||
return jt.Time
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user