-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(datetime/day_of_year): respect time zone of date #3443
Conversation
You can specify time zone in two ways.
But there are some cases where you cannot get result what you want. const firstDay = new Date("2023-01-01T00:00:00.000+09:00"); // first day in year 2023 in east 9th district
console.log(firstDay.getFullYear()) // 2022, my local time zone is east 8th district Maybe it is not a bug. |
When Intantiating |
datetime/day_of_year.ts
Outdated
* | ||
* @return Number of the day in the year in UTC time | ||
*/ | ||
export function dayOfUtcYear(date: Date): number { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utc
in the middle of dayOfYear
sounds strange to me. How about utcDayOfYear
or dayOfYearUtc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer dayOfYearUtc
. Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Maybe fix #1114