OS: Windows 10 Professional (version: 22H2), build 19045.4412
CPU: AMD Ryzen 5 5600 6-Core Processor
RAM: 16305 MiB
Backend: LLVM 17.0.1
Opinion
I think the issue is that ordinals are reported as if in the Julian calendar but day_of_week function works as if it is working in the Gregorian calendar.
Either incrementing the output of the unsafe_date_to_ordinal procedure by 1 (in fact this procedure seems to work correctly), or incrementing the output of the day_of_week procedure by 1 should fix this (a less invasive solution).
Expected Behavior
Entering main.
-----------------------------------------
1th of january 1AD has ordinal 1
its day is <i am not sure of this one>
-----------------------------------------
4th july 2024 has ordinal 739071
its day is Thursday
Current Behavior
Entering main.
-----------------------------------------
1th of january 1AD has ordinal 1
its day is Sunday
-----------------------------------------
4th july 2024 has ordinal 739071
its day is Wednesday
Steps to Reproduce
build this file below then run the output exe file
package main
import "core:fmt"
import dt "core:time/datetime"
main :: proc()
{
fmt.println("Entering main.")
fmt.println("-----------------------------------------")
jan_1st_1ad := dt.Date{day=1,month=1,year=1}
fmt.println("1th of january 1AD has ordinal", dt.unsafe_date_to_ordinal(jan_1st_1ad))
fmt.println("its day is",dt.day_of_week(dt.unsafe_date_to_ordinal(jan_1st_1ad)))
fmt.println("-----------------------------------------")
jul_4th_2024ad := dt.Date {day=4, month=7, year=2024}
fmt.println("4th july 2024 has ordinal", dt.unsafe_date_to_ordinal(jul_4th_2024ad))
fmt.println("its day is", dt.day_of_week(dt.unsafe_date_to_ordinal(jul_4th_2024ad)))
}
Please provide detailed steps for reproducing the issue.
Context
odin report
output:Opinion
I think the issue is that ordinals are reported as if in the Julian calendar but day_of_week function works as if it is working in the Gregorian calendar. Either incrementing the output of the unsafe_date_to_ordinal procedure by 1 (in fact this procedure seems to work correctly), or incrementing the output of the day_of_week procedure by 1 should fix this (a less invasive solution).
Expected Behavior
Current Behavior
Steps to Reproduce
build this file below then run the output exe file
Please provide detailed steps for reproducing the issue.
No additional compiler flags are used.