Skip to content

Commit 95cf5e1

Browse files
committed
♻️ refactor: update base function utilities #2
1 parent a80542a commit 95cf5e1

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

entry.go

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,101 @@ func Monday(s ...string) time.Time {
762762
return With(time.Now()).Monday(s...)
763763
}
764764

765+
// Tuesday returns the date and time of the most recent or upcoming Tuesday relative to the current time.
766+
// This function can take an optional string parameter to specify the desired format for the output,
767+
// but it defaults to the standard representation of time if no arguments are provided.
768+
//
769+
// It utilizes the With() function to obtain the current time and then applies the Tuesday()
770+
// method to determine the appropriate Tuesday date and time.
771+
//
772+
// Returns:
773+
// - A time.Time value representing the most recent or upcoming Tuesday based on the current date and time.
774+
// The output can vary depending on the optional format parameter.
775+
//
776+
// Example:
777+
//
778+
// tuesday := Tuesday() // This will return the date and time for the next upcoming Tuesday (e.g., 2023-10-31 00:00:00).
779+
// tuesdayFormatted := Tuesday("2006-01-02") // This will return the next Tuesday formatted as "YYYY-MM-DD".
780+
func Tuesday(s ...string) time.Time {
781+
return With(time.Now()).Tuesday(s...)
782+
}
783+
784+
// Wednesday returns the date and time of the most recent or upcoming Wednesday relative to the current time.
785+
// This function can take an optional string parameter to specify the desired format for the output,
786+
// but it defaults to the standard representation of time if no arguments are provided.
787+
//
788+
// It utilizes the With() function to obtain the current time and then applies the Wednesday()
789+
// method to determine the appropriate Wednesday date and time.
790+
//
791+
// Returns:
792+
// - A time.Time value representing the most recent or upcoming Wednesday based on the current date and time.
793+
// The output can vary depending on the optional format parameter.
794+
//
795+
// Example:
796+
//
797+
// wednesday := Wednesday() // This will return the date and time for the next upcoming Wednesday (e.g., 2023-11-01 00:00:00).
798+
// wednesdayFormatted := Wednesday("2006-01-02") // This will return the next Wednesday formatted as "YYYY-MM-DD".
799+
func Wednesday(s ...string) time.Time {
800+
return With(time.Now()).Wednesday(s...)
801+
}
802+
803+
// Thursday returns the date and time of the most recent or upcoming Thursday relative to the current time.
804+
// This function can take an optional string parameter to specify the desired format for the output,
805+
// but it defaults to the standard representation of time if no arguments are provided.
806+
//
807+
// It utilizes the With() function to obtain the current time and then applies the Thursday()
808+
// method to determine the appropriate Thursday date and time.
809+
//
810+
// Returns:
811+
// - A time.Time value representing the most recent or upcoming Thursday based on the current date and time.
812+
// The output can vary depending on the optional format parameter.
813+
//
814+
// Example:
815+
//
816+
// thursday := Thursday() // This will return the date and time for the next upcoming Thursday (e.g., 2023-11-02 00:00:00).
817+
// thursdayFormatted := Thursday("2006-01-02") // This will return the next Thursday formatted as "YYYY-MM-DD".
818+
func Thursday(s ...string) time.Time {
819+
return With(time.Now()).Thursday(s...)
820+
}
821+
822+
// Friday returns the date and time of the most recent or upcoming Friday relative to the current time.
823+
// This function can take an optional string parameter to specify the desired format for the output,
824+
// but it defaults to the standard representation of time if no arguments are provided.
825+
//
826+
// It utilizes the With() function to obtain the current time and then applies the Friday()
827+
// method to determine the appropriate Friday date and time.
828+
//
829+
// Returns:
830+
// - A time.Time value representing the most recent or upcoming Friday based on the current date and time.
831+
// The output can vary depending on the optional format parameter.
832+
//
833+
// Example:
834+
//
835+
// friday := Friday() // This will return the date and time for the next upcoming Friday (e.g., 2023-11-03 00:00:00).
836+
// fridayFormatted := Friday("2006-01-02") // This will return the next Friday formatted as "YYYY-MM-DD".
837+
func Friday(s ...string) time.Time {
838+
return With(time.Now()).Friday(s...)
839+
}
840+
841+
// Saturday returns the date and time of the most recent or upcoming Saturday relative to the current time.
842+
// This function can take an optional string parameter to specify the desired format for the output,
843+
// but it defaults to the standard representation of time if no arguments are provided.
844+
//
845+
// It utilizes the With() function to obtain the current time and then applies the Saturday()
846+
// method to determine the appropriate Saturday date and time.
847+
//
848+
// Returns:
849+
// - A time.Time value representing the most recent or upcoming Saturday based on the current date and time.
850+
// The output can vary depending on the optional format parameter.
851+
//
852+
// Example:
853+
//
854+
// friday := Friday() // This will return the date and time for the next upcoming Friday (e.g., 2023-11-03 00:00:00).
855+
// fridayFormatted := Friday("2006-01-02") // This will return the next Friday formatted as "YYYY-MM-DD".
856+
func Saturday(s ...string) time.Time {
857+
return With(time.Now()).Saturday(s...)
858+
}
859+
765860
// Sunday returns the date and time of the most recent or upcoming Sunday relative to the current time.
766861
// This function can take an optional string parameter to specify the desired format for the output,
767862
// but it defaults to the standard representation of time if no arguments are provided.

0 commit comments

Comments
 (0)