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

Safari에서 Date를 다룰 때 신경써야 하는 것들 정리 #68

Open
JaeYeopHan opened this issue Apr 2, 2020 · 1 comment
Open
Labels
related: web Related everything of web type: material For sources

Comments

@JaeYeopHan
Copy link
Owner

JaeYeopHan commented Apr 2, 2020

현상

Screen Shot 2020-04-02 at 9 44 24 AM

플랫폼간 자바스크립트의 new Date()를 처리하는 방식이 다르다.

해결

1. Timezome을 함께 붙인다.

const dateText = '2020-07-01'
new Date(`${dateText}+09:00`)

2. Date.now() 를 사용한다.

new Date(Date.now())
@JaeYeopHan JaeYeopHan added type: material For sources related: web Related everything of web labels Apr 2, 2020
@JaeYeopHan
Copy link
Owner Author

JaeYeopHan commented Jul 1, 2020

  • "yyyy-m-dd"의 형태로 입력받을 경우
    • Safari/IE 에서는 error
    • Chrome/FF 에서는 정상
// safari
new Date("2019-03-15"); 
new Date("2019-3-15"); // safari error!

@JaeYeopHan JaeYeopHan changed the title 브라우저에서 시간 처리를 피해야 하는 이유 Safari에서 Date를 다룰 때 신경써야 하는 것들 정리 Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
related: web Related everything of web type: material For sources
Projects
None yet
Development

No branches or pull requests

1 participant