Rename ToTime->JDateToTime

This commit is contained in:
Petar Kapriš 2024-07-22 21:15:20 +02:00
parent 001ac47315
commit d862f6c35d
2 changed files with 3 additions and 3 deletions

View file

@ -97,7 +97,7 @@ func New(year int, month time.Month, day int) Date {
// The algorithm, in large part: follows this article:
// https://en.wikipedia.org/wiki/Conversion_between_Julian_and_Gregorian_calendars
func ToTime(d Date) time.Time {
func JDateToTime(d Date) time.Time {
offset := -2
borderDate := Date{100, time.March, 2}
// We don't increase the offset for years divisible by 400, ie. every

View file

@ -67,7 +67,7 @@ func TestNextMonth(t *testing.T) {
}
}
func TestToTime(t *testing.T) {
func TestJDateToTime(t *testing.T) {
gDate := func(year int, month time.Month, day int) time.Time {
return time.Date(year, month, day, 0, 0, 0, 0, time.UTC)
}
@ -138,7 +138,7 @@ func TestToTime(t *testing.T) {
for _, tt := range tests {
testname := fmt.Sprintf("%v, %v", tt.d, tt.want)
t.Run(testname, func(t *testing.T) {
ans := ToTime(tt.d)
ans := JDateToTime(tt.d)
if ans != tt.want {
t.Errorf("got %v, want %v", ans, tt.want)
}