From 6c2860473d615db1dd5ab7fde082d1210e006b0c Mon Sep 17 00:00:00 2001 From: gouguoyin <245629560@qq.com> Date: Tue, 19 Apr 2022 23:50:59 +0800 Subject: [PATCH] optimize code --- comparer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/comparer.go b/comparer.go index 8c4beade..935feb42 100755 --- a/comparer.go +++ b/comparer.go @@ -264,7 +264,7 @@ func (c Carbon) IsYesterday() bool { if c.IsInvalid() { return false } - return c.ToDateString() == Now().SubDay().ToDateString() + return c.ToDateString() == Yesterday().ToDateString() } // IsToday reports whether is today. @@ -273,7 +273,7 @@ func (c Carbon) IsToday() bool { if c.IsInvalid() { return false } - return c.ToDateString() == c.Now().ToDateString() + return c.ToDateString() == Now().ToDateString() } // IsTomorrow reports whether is tomorrow. @@ -282,7 +282,7 @@ func (c Carbon) IsTomorrow() bool { if c.IsInvalid() { return false } - return c.ToDateString() == Now().AddDay().ToDateString() + return c.ToDateString() == Tomorrow().ToDateString() } // Compare compares by an operator.