github.com/blend/go-sdk@v1.20240719.1/timeutil/diff_hours_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2024 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package timeutil
     9  
    10  import (
    11  	"testing"
    12  	"time"
    13  
    14  	"github.com/blend/go-sdk/assert"
    15  )
    16  
    17  func TestDiffHours(t *testing.T) {
    18  	assert := assert.New(t)
    19  
    20  	t1 := time.Date(2017, 02, 27, 12, 0, 0, 0, time.UTC)
    21  	t2 := time.Date(2017, 02, 24, 16, 0, 0, 0, time.UTC)
    22  	t3 := time.Date(2017, 02, 28, 12, 0, 0, 0, time.UTC)
    23  
    24  	assert.Equal(68, DiffHours(t2, t1))
    25  	assert.Equal(24, DiffHours(t1, t3))
    26  }