Skip to content

fix(calendar): добавить disabled месяцев [DS-14696]#2041

Open
dHIM24 wants to merge 2 commits intomasterfrom
DS-14696
Open

fix(calendar): добавить disabled месяцев [DS-14696]#2041
dHIM24 wants to merge 2 commits intomasterfrom
DS-14696

Conversation

@dHIM24
Copy link
Contributor

@dHIM24 dHIM24 commented Feb 4, 2026

Calendar
  • В пикере месяцев (selectorView="full") месяцы автоматически дизейблятся, если все дни месяца в offDays.
  • Задизейбленные месяцы отображаются цветом text/tertiary (как задизейбленные дни в сетке календаря).

Чек лист

  • Задача сформулирована и описана в JIRA
  • В названии ветки есть айдишник задачи в JIRA (fix/DS-1234), ссылку прикреплять не надо
  • У реквеста осмысленное название feat(...) или fix(...) по conventional commits (https://www.conventionalcommits.org)
  • Код покрыт тестами и протестирован в различных браузерах
  • Добавленные пропсы добавлены в демки и описаны в документации
  • К реквесту добавлен changeset

Если есть визуальные изменения

  • Прикреплено изображение было/стало
Снимок экрана 2026-02-04 в 11 15 18

Код для песочницы:

const defaultDate = new Date('May 01, 2023 00:00:00');
const offDays = [
    defaultDate.setDate(1),
    defaultDate.setDate(2),
    defaultDate.setDate(3),
    defaultDate.setDate(4),
    defaultDate.setDate(5),
    defaultDate.setDate(6),
    defaultDate.setDate(7),
    defaultDate.setDate(8),
    defaultDate.setDate(9),
    defaultDate.setDate(10),
    defaultDate.setDate(11),
    defaultDate.setDate(12),
    defaultDate.setDate(13),
    defaultDate.setDate(14),
    defaultDate.setDate(15),
    defaultDate.setDate(16),
    defaultDate.setDate(17),
    defaultDate.setDate(18),
    defaultDate.setDate(19),
    defaultDate.setDate(20),
    defaultDate.setDate(21),
    defaultDate.setDate(22),
    defaultDate.setDate(23),
    defaultDate.setDate(24),
    defaultDate.setDate(25),
    defaultDate.setDate(26),
    defaultDate.setDate(27),
    defaultDate.setDate(28),
    defaultDate.setDate(29),
    defaultDate.setDate(30),
    defaultDate.setDate(31),
];



render(() => {
    const [value, setValue] = React.useState();

    React.useEffect(() => {
        setValue();
    }, []);

    const format = React.useCallback((timestamp) => {
        if (!timestamp) return '';

        return new Intl.DateTimeFormat('ru-RU', {
            year: 'numeric',
            month: '2-digit',
            day: '2-digit',
        }).format(new Date(timestamp));
    }, []);

    const selectedDate = React.useMemo(() => {
        return format(value);
    }, [value]);

    const calendarStyles = {
        border: '1px solid rgba(233, 233, 235, 1)',
        borderRadius: '8px',
        boxShadow: 'var(--shadow-m)',
    };

    return (
        <div style={{ width: 344 }}>
            <div style={calendarStyles}>
                <CalendarDesktop
                    defaultMonth={defaultDate.getTime()}
                    offDays={offDays}
                    value={value}
                    responsive={true}
                    onChange={setValue}
                    selectorView={ 'full'}
                    showCurrentYearSelector={true}
                />
            </div>
            <p style={{ marginTop: 32, marginBottom: 32 }}>
                Выбранная дата: {value && selectedDate}
            </p>
        </div>
    );
});

@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2026

🦋 Changeset detected

Latest commit: a2916ac

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

This PR includes changesets to release 8 packages
Name Type
@alfalab/core-components-calendar Minor
@alfalab/core-components Minor
@alfalab/core-components-calendar-input Patch
@alfalab/core-components-calendar-range Patch
@alfalab/core-components-calendar-with-skeleton Patch
@alfalab/core-components-date-range-input Patch
@alfalab/core-components-date-time-input Patch
@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

@dHIM24 dHIM24 requested a review from Oladii February 4, 2026 08:19
@coveralls
Copy link

coveralls commented Feb 4, 2026

Pull Request Test Coverage Report for Build 21751165332

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 11 of 11 (100.0%) changed or added relevant lines in 2 files are covered.
  • 12 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.004%) to 77.038%

Files with Coverage Reduction New Missed Lines %
packages/select/src/utils.ts 12 73.28%
Totals Coverage Status
Change from base Build 21710657089: 0.004%
Covered Lines: 9595
Relevant Lines: 11614

💛 - Coveralls

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Demo build

https://core-ds.github.io/core-components/2041

@dHIM24 dHIM24 marked this pull request as ready for review February 5, 2026 07:24
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Demo build (default)

https://core-ds.github.io/core-components/2041-default

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Demo build (alfasans)

https://core-ds.github.io/core-components/2041-alfasans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants