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

fix(universal-date-input): fix date validation #1545

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fulcanellee
Copy link
Collaborator

@fulcanellee fulcanellee commented Jan 22, 2025

Исправление валидации вводимого времени
https://jira.moscow.alfaintra.net/browse/DS-8066

Copy link

changeset-bot bot commented Jan 22, 2025

🦋 Changeset detected

Latest commit: 11df06b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@alfalab/core-components-universal-date-input Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@core-ds-bot
Copy link
Collaborator

Собрана новая демка.

end: max,
});
const date = clamp(
new Date(`${segments.year}-${segments.month}-${segments.day}T00:00:00`),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут просто сбросил время на 00:00:00?

Copy link
Collaborator Author

@fulcanellee fulcanellee Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавил временную метку, так как без нее new Date в JS автоматически преобразует её в локальное время пользователя, основываясь на его часовом поясе (это ощутимо при смене часовых поясов с очень большой разницей, например добавляем utc 06.01, а в Гонолулу будет 05.01, что приводит к ошибке которую зарепортили).
При добавлении T00:00:00, мы указаываем время в дополнение к дате. JS интерпретирует такую строку как дату и время локальной временной зоны

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.

3 participants