fix: fix dayjs plugin
This commit is contained in:
parent
42eae6cba2
commit
13954fc539
|
@ -3,7 +3,6 @@
|
||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import * as dayjs from 'dayjs';
|
import * as dayjs from 'dayjs';
|
||||||
import * as isToday from 'dayjs/plugin/isToday';
|
|
||||||
import 'dayjs/locale/ru';
|
import 'dayjs/locale/ru';
|
||||||
import 'dayjs/locale/en';
|
import 'dayjs/locale/en';
|
||||||
import 'dayjs/locale/de';
|
import 'dayjs/locale/de';
|
||||||
|
@ -16,8 +15,6 @@ import { AUTH_TOKEN_KEY, AUTH_USER } from '../../constants/common';
|
||||||
import { getRecentSessions, getRequestedSessions, getUpcomingSessions } from '../../actions/profile';
|
import { getRecentSessions, getRequestedSessions, getUpcomingSessions } from '../../actions/profile';
|
||||||
import { Session, Sessions, SessionType } from '../../types/sessions';
|
import { Session, Sessions, SessionType } from '../../types/sessions';
|
||||||
|
|
||||||
dayjs.extend(isToday);
|
|
||||||
|
|
||||||
const Tab = styled.div``;
|
const Tab = styled.div``;
|
||||||
|
|
||||||
export const SessionsTabs = ({ intlConfig, locale }: { intlConfig: Record<string, string>, locale: string }) => {
|
export const SessionsTabs = ({ intlConfig, locale }: { intlConfig: Record<string, string>, locale: string }) => {
|
||||||
|
@ -83,7 +80,7 @@ export const SessionsTabs = ({ intlConfig, locale }: { intlConfig: Record<string
|
||||||
const current = +userId !== client?.id ? client : coach;
|
const current = +userId !== client?.id ? client : coach;
|
||||||
const startDate = dayjs(scheduledStartAtUtc).locale(locale);
|
const startDate = dayjs(scheduledStartAtUtc).locale(locale);
|
||||||
const endDate = dayjs(scheduledEndAtUtc).locale(locale);
|
const endDate = dayjs(scheduledEndAtUtc).locale(locale);
|
||||||
const today = startDate.isToday();
|
const today = dayjs().format('YYYY-MM-DD') === startDate.format('YYYY-MM-DD');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={id} className="card-profile session__item">
|
<div key={id} className="card-profile session__item">
|
||||||
|
|
Loading…
Reference in New Issue