package helper

import (
	"testing"
)

func TestParse(t *testing.T) {
	got, err := Parse("2024-10-01 10:26:57")
	if err != nil {
		t.Errorf("TestParse() error = %v", err)
		return
	}
	t.Log(got)
	got2, err := Parse2("2024-10-01 10:26:57")
	if err != nil {
		t.Errorf("TestParse() error = %v", err)
		return
	}
	t.Log(got2)
}

func TestDateStringToTime(t *testing.T) {
	got, err := DateStringToTime("2024-01-01 00:00:00")
	if err != nil {
		t.Errorf("DateStringToTime() error = %v", err)
		return
	}
	t.Log(got)
	got2, err := DateStringToTime("2024-01-01 00:00:00")
	if err != nil {
		t.Errorf("DateStringToTime() error = %v", err)
		return
	}
	t.Log(got2)
	t.Log(got.Equal(got2))
}

func TestIsTimeBefore(t *testing.T) {
	bes, err := DateStringToTime("2024-01-12 00:00:00")
	if err != nil {
		t.Errorf("DateStringToTime() error = %v", err)
		return
	}
	bts, err := DateStringToTime("2024-01-20 00:00:00")
	if err != nil {
		t.Errorf("DateStringToTime() error = %v", err)
		return
	}
	b := IsTimeBefore(bes, bts)
	t.Log(b) // false
}

func TestIsInSameNaturalMonth(t *testing.T) {
	startTime, err := DateStringToTime("2024-01-12 12:12:12")
	if err != nil {
		t.Errorf("DateStringToTime() error = %v", err)
		return
	}
	endTime, err := DateStringToTime("2024-02-12 12:12:12")
	if err != nil {
		t.Errorf("DateStringToTime() error = %v", err)
		return
	}
	b := IsInSameNaturalMonth(startTime, endTime)
	t.Log(b) // false
}
