Keepers 532922f662
introduce exchange info selector support (#379)
* introduce exchange info selector support

Adds support in selectors/exchange for queries based on
backup.ExchangeInfo entries.  This allows the declaration
of selectors based on non-identifier details such as sender,
subject, or receivedAt time.

Changes Exclude scope matching from being an Any-
match comparator to an All-match.  This keeps exclude
and include behavior identical, hopefully making less
confusion for users.
2022-07-21 15:08:03 -06:00

26 lines
621 B
Go

package common
import (
"errors"
"time"
)
// FormatTime produces the standard format for corso time values.
// Always formats into the UTC timezone.
func FormatTime(t time.Time) string {
return t.UTC().Format(time.RFC3339Nano)
}
// ParseTime makes a best attempt to produce a time value from
// the provided string. Always returns a UTC timezone value.
func ParseTime(s string) (time.Time, error) {
if len(s) == 0 {
return time.Time{}, errors.New("cannot interpret an empty string as time.Time")
}
t, err := time.Parse(time.RFC3339Nano, s)
if err != nil {
return time.Time{}, err
}
return t.UTC(), nil
}