@@ -910,15 +910,19 @@ func (t *Timex) SaturdaySafe(s ...string) (time.Time, error) {
910910 return t .weekdaySafe ("Saturday" , 6 , s ... )
911911}
912912
913- // SundaySafe returns a new time.Time value representing the most recent or upcoming Sunday
913+ // SundaySafe returns a new time.Time value representing the upcoming Sunday
914914// based on the provided date string(s) or the current date if no date strings are provided.
915915// Unlike Sunday(), this method returns an error instead of panicking on parse failures.
916916//
917+ // Note: This method uses the same algorithm as the other weekday methods but with an offset
918+ // calculation that always returns a future Sunday (or today if it's already Sunday at midnight).
919+ // If the current day is Sunday, it returns the next Sunday (7 days later).
920+ //
917921// Parameters:
918922// - s ...string: Optional date string(s) to parse; if none are provided, it defaults to today.
919923//
920924// Returns:
921- // - A `time.Time` value representing the date and time at the start of the most recent or upcoming Sunday.
925+ // - A `time.Time` value representing the date and time at the start of the upcoming Sunday.
922926// - An error if parsing fails.
923927func (t * Timex ) SundaySafe (s ... string ) (time.Time , error ) {
924928 var parseTime time.Time
@@ -1401,7 +1405,7 @@ func (t *Timex) IsFuture() bool {
14011405func (t * Timex ) parseWithFormat (s string , location * time.Location ) (v time.Time , err error ) {
14021406 formats := t .getTimeFormats ()
14031407 if len (formats ) == 0 {
1404- err = fmt .Errorf ("timefy: no time formats configured for parsing %q" , s )
1408+ err = fmt .Errorf ("timefy: no time formats configured for parsing %q; ensure Timex is created via With() or NewRule().With() " , s )
14051409 return
14061410 }
14071411 for _ , format := range formats {
0 commit comments