import React from 'react';
import { XStack } from 'tamagui';
import CustomText from '@/components/common/CustomText.jsx';
import dayjs from 'dayjs';
import { wp, sp } from '@/utils/ui/screenUtils';
import { useTranslation } from '@/node_modules/react-i18next';

/**
 * 日期显示组件
 */
const DateDisplay = () => {
  const { t } = useTranslation('attendance');
  // 获取当前日期和星期
  const getCurrentDate = () => {
    const now = dayjs();
    const weekdayKey = `weekdays.${now.day()}`; // 0-6
    const weekday = t(weekdayKey);
    return `${now.format('YYYY.MM.DD')} ${weekday}`;
  };
  // const getCurrentDate = () => {
  //   const now = dayjs();
  //   const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
  //   const weekday = weekdays[now.day()];
  //   return `${now.format('YYYY.MM.DD')} ${weekday}`;
  // };
  return (
    <XStack 
      style={{ 
        width: '100%', 
        height: wp(45), 
        backgroundColor: '#fff', 
        alignItems: 'center', 
        paddingRight: wp(10), 
        paddingLeft: wp(16), 
        justifyContent: 'flex-start', 
        borderRadius: wp(4), 
        marginBottom: wp(10),
      
      }}
    >
      <CustomText style={{ color: '#1A1A1A', fontFamily: 'Bold', fontSize: sp(14) }}>{getCurrentDate()}</CustomText>
    </XStack>
  );
};

export default DateDisplay;