@@ -92,7 +92,7 @@ func FromString(s string, layouts ...string) (*Time, error) {
9292 return New (t ), nil
9393}
9494
95- // LocalByName time for now
95+ // LocalByName time for now. eg: "Local", "UTC", "Asia/Shanghai"
9696func LocalByName (tzName string ) * Time {
9797 loc , err := time .LoadLocation (tzName )
9898 if err != nil {
@@ -274,21 +274,20 @@ func (t *Time) CustomHMS(hour, min, sec int) *Time {
274274 return FromTime (newTime )
275275}
276276
277+ // IsEmpty check if time is empty. alias for t.IsZero
278+ func (t * Time ) IsEmpty () bool { return t .IsZero () }
279+
277280// IsBefore the given time
278281func (t * Time ) IsBefore (u time.Time ) bool { return t .Before (u ) }
279282
280283// IsBeforeUnix the given unix timestamp
281- func (t * Time ) IsBeforeUnix (ux int64 ) bool {
282- return t .Before (time .Unix (ux , 0 ))
283- }
284+ func (t * Time ) IsBeforeUnix (ux int64 ) bool { return t .Before (time .Unix (ux , 0 )) }
284285
285286// IsAfter the given time
286287func (t * Time ) IsAfter (u time.Time ) bool { return t .After (u ) }
287288
288289// IsAfterUnix the given unix timestamp
289- func (t * Time ) IsAfterUnix (ux int64 ) bool {
290- return t .After (time .Unix (ux , 0 ))
291- }
290+ func (t * Time ) IsAfterUnix (ux int64 ) bool { return t .After (time .Unix (ux , 0 )) }
292291
293292// Timestamp value. alias of t.Unix()
294293func (t * Time ) Timestamp () int64 { return t .Unix () }
0 commit comments