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

ax5.util.date 첫 번째 인자 값으로 1월 1일 오전 9시 미만 시간 사용시 이슈 #3

Open
Changil3873 opened this issue Jan 30, 2018 · 1 comment

Comments

@Changil3873
Copy link

ax5core version: 1.4.121

아래의 코드를 실행하면 년도가 -1이 된 결과가 반환됩니다.

ax5.util.date(new Date(2018, 0, 1), {return: "yyyy-MM-dd"});

"2017-01-01"

ax5.util.date의 첫 번째 인자 값이 문자열로 생성된 new Date("2018-01-01") 또는 "2018-01-01"의 경우 정상적인 결과를 반환합니다. 년/월/일 인자 값을 전달 받아 생성된 1월 1일 Date 객체가 ax5.util.date에 의해서 년도 값을 반환하는 경우에만 문제가 발생하는 것 같습니다.

@Changil3873 Changil3873 changed the title ax5.util.date에서 Date 객체 사용시 이슈 ax5.util.date 첫 번째 인자 값으로 1월 1일 오전 9시 미만 시간 사용시 이슈 May 9, 2018
@Changil3873
Copy link
Author

ax5core version: 1.4.126

첫 번째 인자 값에 1월 1일 오전 9시 미만의 시간을 사용하면 잘못된 결과를 반환합니다.

ax5.util.date("2018-01-01 08:59:59", {return: "yyyy-MM-dd hh:mm:ss"})

"2018-01-01 09:59:00"

ax5.util.date("2018-01-01 00:00:00", {return: "yyyy-MM-dd hh:mm:ss"})

"2018-01-01 09:00:00"

ax5.util.date("2018-01-01T00:59:59", {return: "yyyy-MM-dd hh:mm:ss"})

"2017-01-01 00:59:59"

또한 첫 번째 인자 값에 날짜와 시간 구분자 'T'가 없을 경우 초단위가 '00'으로 나타납니다.

ax5.util.date("2018-01-01 11:59:59", {return: "yyyy-MM-dd hh:mm:ss"})

"2018-01-01 11:59:00"

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

No branches or pull requests

1 participant