You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// IsWeekday checks if the current time is a weekday (Monday to Friday).
836
+
//
837
+
// Returns:
838
+
// - A boolean value indicating whether the current time is a weekday.
839
+
//
840
+
// Example:
841
+
//
842
+
// t := Timex{Time: time.Now()}
843
+
// isWeekday := t.IsWeekday() // Returns true if the current time is a weekday
844
+
func (t*Timex) IsWeekday() bool {
845
+
return!t.IsWeekend()
846
+
}
847
+
848
+
// IsBefore checks if the current time is before the specified time.
849
+
//
850
+
// Parameters:
851
+
// - `other`: The other time to compare against.
852
+
//
853
+
// Returns:
854
+
// - A boolean value indicating whether the current time is before the specified time.
855
+
//
856
+
// Example:
857
+
//
858
+
// t := Timex{Time: time.Now()}
859
+
// isBefore := t.IsBefore(time.Now().AddDate(0, 0, 1)) // Returns true if the current time is before the specified time
860
+
func (t*Timex) IsBefore(other time.Time) bool {
861
+
returnt.Time.Before(other)
862
+
}
863
+
864
+
// IsAfter checks if the current time is after the specified time.
865
+
//
866
+
// Parameters:
867
+
// - `other`: The other time to compare against.
868
+
//
869
+
// Returns:
870
+
// - A boolean value indicating whether the current time is after the specified time.
871
+
//
872
+
// Example:
873
+
//
874
+
// t := Timex{Time: time.Now()}
875
+
// isAfter := t.IsAfter(time.Now().AddDate(0, 0, 1)) // Returns true if the current time is after the specified time
876
+
func (t*Timex) IsAfter(other time.Time) bool {
877
+
returnt.Time.After(other)
878
+
}
879
+
880
+
// IsBetween checks if the current time is between the specified start and end times (inclusive).
881
+
//
882
+
// Parameters:
883
+
// - `start`: The start time of the range.
884
+
// - `end`: The end time of the range.
885
+
//
886
+
// Returns:
887
+
// - A boolean value indicating whether the current time is between the specified start and end times.
888
+
//
889
+
// Example:
890
+
//
891
+
// t := Timex{Time: time.Now()}
892
+
// isBetween := t.IsBetween(time.Now().AddDate(0, 0, 1), time.Now().AddDate(0, 0, 2)) // Returns true if the current time is between the specified start and end times
893
+
func (t*Timex) IsBetween(start, end time.Time) bool {
0 commit comments