Vue3获取阴历/农历日期

安装插件

javascript 复制代码
pnpm add chinese-lunar-calendar

引入阳历/阴历切换函数

javascript 复制代码
import {getLunar} from 'chinese-lunar-calendar'

export function lunarDate(pDate){
    const year = pDate.getFullYear()
    const month = pDate.getMonth() +1
    const day = pDate.getDate()
    const result = getLunar(year,month,day)
    return result.dateStr
}

调用方法

javascript 复制代码
const date = new Date()
const result = lunarDate(date)//十月廿十
相关推荐
宸津-代码粉碎机12 小时前
FastUtil+AI多Agent实战:Java AI项目性能终极加速方案
java·服务器·开发语言·python·安全·php
Python私教12 小时前
Python 3.15 来了:free-threading 稳定 ABI 能给高并发服务带来什么
开发语言·python
CAD老兵13 小时前
在浏览器里对比 DWG/DXF 图纸 —— @mlightcad/cad-diff-viewer
前端·javascript·github
Logintern0913 小时前
[Matlab] 遗传算法求解TSP入门
开发语言·matlab
WL_arm14 小时前
Vibe Coding(氛围编程)入门
javascript·css·人工智能·html5
艾醒(AiXing-w)14 小时前
LangChain 1.0 入门(二):LangChain 全模型标准化接入最佳实践(小白参数详解版)
前端·javascript·langchain
练习时长两年半的RL练习生14 小时前
与AI对话后对 Actor-Critic 中 TD Target 的 a‘ 来源总结
开发语言·人工智能·php
十五年专注C++开发14 小时前
100w条数据丝滑滚动!Qt Model/View 架构实战(二)
开发语言·c++·qt
萧瑟余晖15 小时前
Java深入解析篇三十九之集成测试
java·开发语言·集成测试
skr爱码士15 小时前
06_Qt 常用数据类型与容器:QString、QList、QVector、QMap 的性能与实现分析
开发语言·c++·qt