CF-678B The Same Calendar (日历蔡勒公式)

本文介绍了一个算法,用于计算给定年份之后的下一个具有相同日历布局的年份,考虑到平年和闰年的差异。通过计算特定日期在一周中的位置来确定年份是否具有相同的日历。

                                                                        The Same Calendar

The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.

The calendar is so beautiful that she wants to know what is the next year after ywhen the calendar will be exactly the same. Help Taylor to find that year.

Note that leap years has 366 days. The year is leap if it is divisible by 400 or it is divisible by 4, but not by 100 (https://en.wikipedia.org/wiki/Leap_year).

Input

          The only line contains integer y (1000 ≤ y < 100'000) — the year of the calendar.

Output

          Print the only integer y' — the next year after y when the calendar will be the same. Note that you should find the first year              after y with the same calendar.

Examples

input:2016

output:2044

input:2000

output:2028

input:50501

output:50507

#include<stdio.h>
#include<math.h>

int countweek(int year,int month,int day)
{
    int y,c,week;
    y=year%100;
    c=year/100;
    if (month ==1 || month == 2)
    {
        month += 12;
        y--;
    }
    week=y+y/4+c/4-2*c+26*(month+1)/10+day-1;
    if(year%400==0&&month>12)
        week--;
    while(week<0)
    {
        week+=7;
    }
    week=week%7;
    return week;
}

int main()
{
    int year;
    while(scanf("%d",&year)!=EOF)
    {
        int a=countweek(year,2,2),b=countweek(year,3,1);
        while(1)
        {
            year+=1;
            if(countweek(year,2,2)==a&&countweek(year,3,1)==b)
                break;
        }
        printf("%d\n",year);
    }
}

 

我的代码是:import xarray as xr # 1. 加载 NetCDF 数据 cmip6_files = [ r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_218101-219012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_219101-220012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_220101-221012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_221101-222012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_222101-223012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_223101-224012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_224101-225012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_225101-226012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_226101-227012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_227101-228012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_228101-229012.nc', r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn_229101-230012.nc'] ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') # 2. 设置涠洲岛的经纬度范围 lon_min, lon_max = 108.5, 110.5 lat_min, lat_max = 20.5, 22.5 # 3. 先计算布尔掩码(强制使用 .compute()) lat_mask = (ds.latitude >= lat_min) & (ds.latitude <= lat_max) lon_mask = (ds.longitude >= lon_min) & (ds.longitude <= lon_max) final_mask = (lat_mask & lon_mask).compute() # 4. 使用掩码裁剪数据 clipped = ds.where(final_mask, drop=True) # 5. 删除 time_bnds 变量以避免编码错误 clipped = clipped.drop_vars('time_bnds', errors='ignore') # 6. 检查裁剪后是否为空 if clipped.sizes['i'] == 0 or clipped.sizes['j'] == 0: raise ValueError("裁剪后 i 或 j 维度为空,请检查经纬度范围是否在数据范围内。") # 7. 保存裁剪后的数据 print("开始保存文件...") clipped.to_netcdf(r'D:\\SSP126\\dissic_Omon_ACCESS-ESM1-5_ssp126_r1i1p1f1_gn.nc') print("文件保存成功!") 我运行的错误是:D:\pycharm\CMIP6\裁剪空间\.venv\Scripts\python.exe D:\pycharm\CMIP6\裁剪空间\裁剪空间.py D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') D:\pycharm\CMIP6\裁剪空间\裁剪空间.py:17: SerializationWarning: Unable to decode time axis into full numpy.datetime64[ns] objects, continuing using cftime.datetime objects instead, reason: dates out of range. To silence this warning use a coarser resolution 'time_unit' or specify 'use_cftime=True'. ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') Traceback (most recent call last): File "D:\pycharm\CMIP6\裁剪空间\裁剪空间.py", line 17, in <module> ds = xr.open_mfdataset(cmip6_files, engine='netcdf4', combine='by_coords') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\pycharm\CMIP6\裁剪空间\.venv\Lib\site-packages\xarray\backends\api.py", line 1823, in open_mfdataset combined = combine_by_coords( ^^^^^^^^^^^^^^^^^^ File "D:\pycharm\CMIP6\裁剪空间\.venv\Lib\site-packages\xarray\structure\combine.py", line 1035, in combine_by_coords concatenated_grouped_by_data_vars = tuple( ^^^^^^ File "D:\pycharm\CMIP6\裁剪空间\.venv\Lib\site-packages\xarray\structure\combine.py", line 1036, in <genexpr> _combine_single_variable_hypercube( File "D:\pycharm\CMIP6\裁剪空间\.venv\Lib\site-packages\xarray\structure\combine.py", line 694, in _combine_single_variable_hypercube combined_ids, concat_dims = _infer_concat_order_from_coords(list(datasets)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\pycharm\CMIP6\裁剪空间\.venv\Lib\site-packages\xarray\structure\combine.py", line 147, in _infer_concat_order_from_coords _ensure_same_types(series, dim) File "D:\pycharm\CMIP6\裁剪空间\.venv\Lib\site-packages\xarray\structure\combine.py", line 96, in _ensure_same_types raise TypeError(error_msg) TypeError: Cannot combine along dimension 'time' with mixed types. Found: DatetimeProlepticGregorian, Timestamp. If importing data directly from a file then setting `use_cftime=True` may fix this issue. 进程已结束,退出代码为 1
09-03
const {width, height} = Dimensions.get('window'); const isLargeScreenIphone = () => { if (Platform.OS !== 'ios') return false; // 主流大屏分辨率:宽度 >= 414,或高度 >= 812 (iPhone X以上) return width >= 414 && height >= 896; } // 设置中文本地化配置 LocaleConfig.locales['zh'] = { monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'], today: "今天" }; // 设置默认的本地化配置为中文 LocaleConfig.defaultLocale = 'zh'; const tabMapping = { 'allCalendar': <AllPage/>, //全部日历 'appJobCalendar': <OutLookPage/>, //日程日历 'appFeishuCalendar': <FeiShuPage/>, //飞书日历 'alternative_investment_calendar': <AiPage/>, //另类投资日历 'ir_calendar_index': <IrPage/>, //投研日历 'ims_calendar_index': <ImsPage/>,//ims日历 }; const ExpandableCalendarScreen = observer((props) => { const storeApi = CalendarStore; const [reload, setReload] = useState(0) const [routeData, setRouteData] = useState([]); const routeDataRef = useRef([]) const tabIndexRef = useRef(0) const pageidRef = useRef('allCalendar') const [datePickerFlag, setDatePickerFlag] = useState(false) const [defaultDate, setDefaultDate] = useState("") const curDate = new Date() const monthDebounceRef = useRef(); const dateChangeDebounceRef = useRef(); const [selectedDate, setSelectedDate] = useState(moment().format('YYYY-MM-DD')); const showChangeMonthRef = useRef(false);//false是周历,true是月历 //卸载计时器 useEffect(() => { return () => { if (monthDebounceRef.current) { clearTimeout(monthDebounceRef.current); } if (dateChangeDebounceRef.current) { clearTimeout(dateChangeDebounceRef.current); } }; }, []); //初始化数据 const getRoute = async () => { let routeList = [] if (typeof storeApi.tabData != 'undefined' && storeApi.tabData.length > 0) { storeApi.tabData.map((item) => { let route = {key: '', title: '', pageid: '', myAssembly: ''} route.key = item.category route.title = item.title route.pageid = item.pageid route.myAssembly = tabMapping[item.pageid] routeList.push(route) }) } routeDataRef.current = routeList await getPageId(0) await setRouteData(routeList) } useEffect(() => { getRoute() setTheme(getTheme()) setDefaultDate(moment().format('YYYY-MM')) }, []); useEffect(() => { let marked = storeApi.markedData if (pageidRef.current != calendarTypeMapping.all.pageid) {//非全部日历tab要过滤marked数据 let typeArr = Object.keys(calendarTypeMapping).filter((typeKey) => pageidRef.current == calendarTypeMapping[typeKey]['pageid']).map((typeKey) => calendarTypeMapping[typeKey]) let type = typeArr.length > 0 ? typeArr[0]['type'] : '' marked = Object.keys(storeApi.markedData).reduce((result, key) => { if (!result[key]?.dots) { result[key] = {'dots': []} } result[key]['dots'].push(...storeApi.markedData[key]['dots'].filter((item) => item.key == type)); return result }, {}) } else {//全部数据过期时只保留一条过期的数据 marked = Object.keys(storeApi.markedData).reduce((result, key) => { let date = key if (!result[key]?.dots) { result[key] = {'dots': []} } if (moment(date).format('YYYYMMDD') < moment().format('YYYYMMDD')) {//过期 result[key]['dots'] = storeApi.markedData[key]['dots'].length > 0 ? [storeApi.markedData[key]['dots'][0]] : [] } else { result[key]['dots'].push(...storeApi.markedData[key]['dots']) } return result }, {}) } // 保证selectedDate有key if (!marked[selectedDate]) { marked[selectedDate] = {dots: []}; } // 所有key,只让selectedDate为true,其他为false Object.keys(marked).forEach(key => { // console.log('key', key); // console.log('selectedDate', selectedDate); marked[key].selected = (key === selectedDate); }); setMarked({...marked}); // 创建一个新的对象, }, [storeApi.markedData, tabIndexRef.current, selectedDate]); const [theme, setTheme] = useState() const todayBtnTheme = useRef({ todayButtonTextColor: themeColor }); // const [currentDate, setCurrentDate] = useState(moment().format('YYYY-MM-DD')); const currentDate=useRef(moment().format('YYYY-MM-DD')) const [showToday, setShowToday] = useState(false);// 是否显示今天 const [marked, setMarked] = useState(storeApi.markedData); const clickFlag=useRef(false) // 使用 useCallback 优化事件处理 const onDateChanged = useCallback((date) => { let cflag=false//用来标记修改标志的 if (dateChangeDebounceRef.current) { clearTimeout(dateChangeDebounceRef.current); } let checkDate=date const todayDate = new Date(); const today=moment().format('YYYY-MM-DD') const selectedDateObj = new Date(selectedDate); const callbackDateObj = new Date(date); const isSameMonth1 = todayDate.getFullYear() === callbackDateObj.getFullYear() && todayDate.getMonth() === callbackDateObj.getMonth(); const isSameMonth2 = selectedDateObj.getFullYear() === callbackDateObj.getFullYear() && selectedDateObj.getMonth() === callbackDateObj.getMonth(); setTimeout(() => {//延迟保证点击时间修改了clickFlag后再执行 if ((isSameMonth1 || isSameMonth2) && showChangeMonthRef.current) { if (clickFlag.current) { checkDate = today clickFlag.current = false cflag = true } else { checkDate = date clickFlag.current = false cflag = true } } dateChangeDebounceRef.current = setTimeout(() => { if (!cflag) { clickFlag.current = true } storeApi.curSelectDate = moment(checkDate).format('YYYYMMDD'); storeApi.getCurrentDate(checkDate); // setCurrentDate(moment(date).format('YYYY-MM-DD')); currentDate.current = moment(checkDate).format('YYYY-MM-DD') console.log('onDateChanged set selectedDate2222', moment(checkDate).format('YYYY-MM-DD'), selectedDate, currentDate); setSelectedDate(moment(checkDate).format('YYYY-MM-DD')); if (isToday(moment(checkDate).format('YYYY-MM-DD'))) { setShowToday(false); } else { setShowToday(true); } }, 400); }, 10); }, []); // 回到今天 const goToToday = () => { const today = moment().format('YYYY-MM-DD'); storeApi.curSelectDate = moment(today).format('YYYYMMDD') storeApi.getCurrentDate(today); // setCurrentDate(today) currentDate.current=today setDefaultDate(moment(today).format('YYYY-MM-DD')) setSelectedDate(moment(today).format('YYYY-MM-DD')) }; //关闭年月选择器 const hideView = () => { setDatePickerFlag(false); } const getDate = (date: any) => { setDefaultDate(moment(date).format('YYYY-MM-DD')) // setCurrentDate(moment(date).format('YYYY-MM-DD')); currentDate.current=moment(date).format('YYYY-MM-DD') setSelectedDate(moment(date).format('YYYY-MM-DD')) setDatePickerFlag(false) } //打开选择器按钮 const openPicker = () => { if (datePickerFlag) { setDatePickerFlag(false) } else { setDatePickerFlag(true) } } // 折叠效果 显示月度日历和周日历 const positionsStatusRef = useRef(ExpandableCalendar.positions.CLOSED) // 日历展开折叠 const onCalendarToggled = (calendarOpened) => { // setShowChangeMonth(calendarOpened) showChangeMonthRef.current = calendarOpened }; //根据index获取pageId const getPageId = async (index) => { let routeArr = routeDataRef.current.filter((item, key) => key == index) let pageId = routeArr.length > 0 ? routeArr[0]['pageid'] : '' pageidRef.current = pageId storeApi.tabType = pageId } const handleSelectDay = useCallback((dayObj: { dateString: string }) => { const currentMonth = moment().format('YYYY-MM'); const changedMonth = moment(dayObj.dateString).format('YYYY-MM'); if(currentMonth!=changedMonth){ clickFlag.current=true }else{ clickFlag.current=false } const formatted = dayjs(dayObj.dateString).format('YYYY-MM-DD'); setSelectedDate(formatted); storeApi.curSelectDate = formatted // setCurrentDate(formatted); currentDate.current=formatted let isToday = storeApi.curSelectDate == moment().format('YYYYMMDD') let theme = getTheme(pageidRef.current, isToday) setTheme(prev => ({...theme})) setReload(1); }, []); //tab切换事件 const tabSelect = async (index) => { tabIndexRef.current = index; storeApi.tabIndex = index await getPageId(index); let isToday = storeApi.curSelectDate == moment().format('YYYYMMDD'); let theme = getTheme(pageidRef.current, isToday); await setTheme(prev => ({...theme})); await setReload(1); }; // Header 渲染函数 date.toString('yyyy年MM月' const renderHeader = useCallback( (date: XDate) => ( <View style={styles.header}> <View style={styles.headerLeft}> <TouchableOpacity style={styles.ymdSty} onPress={() => { openPicker() }}><Text style={styles.headerText}>{date?date.toString('yyyy年MM月'):moment(selectedDate).format('yyyy年MM月')}</Text> <Image style={styles.upImage} source={{uri: datePickerFlag ? (cdnHost + '?mFileName=5a4c0cf34d8efcc043b69d2a6a8f04a3') : (cdnHost + '?mFileName=ca8f744f33202c452c7c5ec4c050ba72')}} /> </TouchableOpacity> { showToday && <TouchableOpacity onPress={goToToday}> <Image style={styles.todayImage} source={{uri: cdnHost + '?mFileName=e97e6d1f124f6aabda71ca38c102ff18'}} /> </TouchableOpacity> } </View> </View> ) ); return ( <View style={{flex: 1}}> <CalendarProvider date={currentDate.current} onDateChanged={(dateString) => { onDateChanged(dateString) }} // onMonthChange={(dateString) => { // onDateChanged(dateString.dateString) // }} disableAutoDaySelection={[CalendarNavigationTypes.MONTH_SCROLL]} showTodayButton={false} theme={todayBtnTheme.current} > <LinearGradient colors={['rgba(255,255,255,0)', '#fff']} start={{x: 0, y: 0}} // 起点 end={{x: 0, y: Platform.OS == "ios" ? (isLargeScreenIphone() ? 0.8 : 1) : 1}} // 终点,横向渐变 style={{ position: "absolute", width: "100%", height: rem(20), zIndex: 10, top: Platform.OS == "ios" ? (isLargeScreenIphone() ? -20 : -12) : -20 }} > {/* 内部内容 */} </LinearGradient> <ExpandableCalendar key={reload} hideArrows hideKnob={false} onCalendarToggled={onCalendarToggled} initialPosition={positionsStatusRef.current} // 禁用滑动和拖动手势 disableWeekScroll={false} theme={theme} calendarHeight={400} firstDay={0} current={currentDate.current} markingType={'multi-dot'} markedDates={marked} renderHeader={renderHeader} onDayPress={handleSelectDay} closeOnDayPress={false} dayComponent={({ date, state, marking }) => { const isCurrentSelected = date.dateString === selectedDate; const isToday = moment(date.dateString).isSame(moment(), 'day'); let textColor = '#2F3033'; // 默认颜色 if (state === 'disabled') { textColor = '#ccc'; // 非本月日期 → 灰色 } else if (isCurrentSelected) { textColor = '#fff'; // 选中日期 → 白色文字 } else if (isToday) { textColor = themeColor; // 今天 → 主题色 } else { textColor = '#2F3033'; // 正常日期 } return ( <TouchableOpacity onPress={() => handleSelectDay({ dateString: date.dateString })} style={[ styles.dayContainer, isCurrentSelected && styles.selectedDay, state === 'disabled' && styles.disabledDay, // 可选:加背景透明 ]} activeOpacity={0.7} > <Text style={[styles.dayText, { color: textColor }]}> {date.day} </Text> {/* 渲染 multi-dot 标记 */} {marking?.dots?.length > 0 ? ( <View style={styles.dotsContainer}> {marking.dots.map((dot, i) => ( <View key={i} style={[styles.dot, { backgroundColor: dot.color }]} /> ))} </View> ):<View style={styles.dotsContainer}> </View>} </TouchableOpacity> ); }} /> <View style={{ position: "relative", bottom: 10, backgroundColor: "#fff", width: "100%", height: rem(15), borderBottomLeftRadius: rem(8), borderBottomRightRadius: rem(8), }}> </View> <View style={{ flex: 1, width: viewBaseInfo.S_WIDTH, height: rem(100), backgroundColor: '#F5F6F9', top: rem(-10) }}> <TabEllipseAuto textFontSize={rem(14)} tabSpacing={rem(6)} tabBarContainer={{borderTopLeftRadius: 8, borderTopRightRadius: 8}} routeData={routeData} getSelectIndex={tabSelect} /> </View> <DatePickerViewCustom defaultValue={defaultDate} show={datePickerFlag} onClose={hideView} title="请选择" precision='month' onDateChange={getDate} maxDate={curDate} minDate={new Date(curDate.getFullYear(), 0, 1)} /> </CalendarProvider> </View> ); }); export default ExpandableCalendarScreen; const styles = StyleSheet.create({ calendar: { paddingLeft: 20, paddingRight: 20 }, section: { backgroundColor: lightThemeColor, color: 'grey', textTransform: 'capitalize' }, header: { flex: 1, // marginTop: 6, flexDirection: 'row', justifyContent: 'space-between', // 在主轴(水平轴)上均匀分布空间 alignItems: 'center', // 在交叉轴(垂直轴)上居中对齐 height: 30, }, headerLeft: { flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', marginLeft: rem(8) }, headerRight: { flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-end', marginRight: rem(6) }, headerText: { fontSize: 16, color: '#2F3033', fontWeight: "500", fontFamily: 'PingFangSC-Medium', // 替换为你要使用的自定义字体 }, upImage: { width: rem(8), height: rem(6), marginLeft: rem(3) }, todayImage: { width: rem(20), height: rem(20), marginLeft: rem(8) }, leftImage: { width: rem(20), height: rem(20), marginRight: rem(8) }, rightImage: { width: rem(20), height: rem(20), }, touchSty: {width: rem(16), height: rem(16), alignItems: 'center', justifyContent: 'center',}, ymdSty: { flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', }, dayContainer: { alignItems: 'center', justifyContent: 'center', width: 25, height: 30, borderRadius: 30, }, disabledDay: { opacity: 0.5, // 可选:让非本月整体变淡 }, dayText: { fontSize: 16, fontWeight: '500', }, selectedDay: { backgroundColor: themeColor, }, dotsContainer: { flexDirection: 'row', marginTop: 4, }, dot: { width: 4, height: 4, borderRadius: 2, marginHorizontal: 1, }, });初始化的时候日历不渲染
最新发布
11-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值