vue 农历日期转公历日期(含插件 js-calendar-converter 使用教程)

安装插件

cnpm install js-calendar-converter --S

导入插件

import calendar_converter from 'js-calendar-converter'

农历日期转公历日期

let new_date = calendar_converter.lunar2solar(2023, 12, 01)
let new_year = new_date.cYear
let new_month = new_date.cMonth < 10 ? ('0' + new_date.cMonth) : new_date.cMonth
let new_day = new_date.cDay < 10 ? ('0' + new_date.cDay) : new_date.cDay

console.log('公历日期为:', new_year + new_month + new_day)

得到公历日期 20240111

更多属性和方法见
https://blog.csdn.net/weixin_51157081/article/details/131285709

相关推荐

  1. 前端实用-日期处理工具Moment.js

    2024-01-10 11:00:04       30 阅读
  2. uView Calendar 日历

    2024-01-10 11:00:04       33 阅读
  3. Calendar日历

    2024-01-10 11:00:04       36 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-10 11:00:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-10 11:00:04       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-10 11:00:04       82 阅读
  4. Python语言-面向对象

    2024-01-10 11:00:04       91 阅读

热门阅读

  1. Docker修改数据目录

    2024-01-10 11:00:04       52 阅读
  2. 第十五章 ECMAScript6新增的常用语法

    2024-01-10 11:00:04       62 阅读
  3. 前端使用网址收藏

    2024-01-10 11:00:04       61 阅读
  4. 12. C++ kmalloc、kzalloc、vmalloc的区别

    2024-01-10 11:00:04       57 阅读
  5. 考研自命题资料、考题如何找

    2024-01-10 11:00:04       51 阅读
  6. 店铺出租标书

    2024-01-10 11:00:04       51 阅读