Skip to content
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

always use server's locale to parse date #1343

Merged
merged 1 commit into from
Sep 4, 2015
Merged

Conversation

onealtang
Copy link
Contributor

When parsing the date without time, it's always using UTC date, which is
unexpected. suppose we get '2015-09-02' from page, it's always parsed as '2015-09-02 00:00:00 UTC' but by default, what we expect is '2015-09-02 00:00:00' at local time zone.

And If we want to use UTC date throughout the system, it's recommend to set all
server's timezone as UTC including DB.

When parsing the date without time, it's always using UTC date, which is
unexpected. If we want to use UTC date, it's recommend to set the
server's timezone as UTC, and keep the code flexible.
astaxie added a commit that referenced this pull request Sep 4, 2015
always use server's locale to parse date
@astaxie astaxie merged commit 9038cdf into beego:develop Sep 4, 2015
@thanzen
Copy link

thanzen commented Sep 6, 2015

It will add more confusions when people need to support multi time zones in their applications if we use local machine's setting.
I think we should always to use one format(utc) for time in beego, and adding custom translation based on specific project's need(developer's choice).

@astaxie
Copy link
Member

astaxie commented Sep 7, 2015

@thanzen yea, it's trade-off. but in most case it just use the local timezone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants