微信小程序学习用:日历:公历农历转换,calendar-convert[小鱼微信小程序]

微信小程序学习用:日历:公历农历转换,calendar-convert由小鱼微信小程序精心整理,并分享给大家。喜欢该资源的小伙伴请下载使用,注册、回复、每日签到、点赞送大量积分,满足您免费下载的愿望

微信小程序学习用:日历:公历农历转换,calendar-convert挺好 微信小程序学习用:日历:公历农历转换,calendar-convert

示例代码:

[AppleScript]
//morningf@foxmail.com  var ccFile = require('../../utils/calendar-converter.js') var calendarConverter = new ccFile.CalendarConverter();  //月份天数表 var DAY_OF_MONTH = [     [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],     [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] ];  //判断当前年是否闰年 var isLeapYear = function(year){     if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))         return 1     else         return 0 };  //获取当月有多少天 var getDayCount = function(year, month){     return DAY_OF_MONTH[isLeapYear(year)][month]; };  //获取当前索引下是几号 var getDay = function(index) {     return index - curDayOffset; };  var pageData = {     date: "",                //当前日期字符串      //arr数据是与索引对应的数据信息     arrIsShow: [],          //是否显示此日期     arrDays: [],            //关于几号的信息     arrInfoEx: [],          //农历节假日等扩展信息     arrInfoExShow: [],      //处理后用于显示的扩展信息      //选择一天时显示的信息     detailData: {         curDay: "",         //detail中显示的日信息         curInfo1: "",         curInfo2: "",     }      }  //设置当前详细信息的索引,前台的详细信息会被更新 var setCurDetailIndex = function(index){     var curEx = pageData.arrInfoEx[index];     curDay = curEx.sDay - 1;     pageData.detailData.curDay = curEx.sDay;     pageData.detailData.curInfo1 = "农历" + curEx.lunarMonth + "月" + curEx.lunarDay;     pageData.detailData.curInfo2 = curEx.cYear+curEx.lunarYear + "年 " + curEx.cMonth + "月 " + curEx.cDay + "日 " + curEx.lunarFestival; }  //刷新全部数据 var refreshPageData = function(year, month, day){     pageData.date = year+'年'+(month+1)+'月';      var offset = new Date(year, month, 1).getDay();      for (var i = 0; i < 42; ++i)     {         pageData.arrIsShow[i] = i < offset || i >= getDayCount(year, month) + offset ? false : true;         pageData.arrDays[i] = i - offset + 1;         var d = new Date(year, month, i - offset + 1);         var dEx = calendarConverter.solar2lunar(d);         pageData.arrInfoEx[i] = dEx;         if ("" != dEx.lunarFestival)         {             pageData.arrInfoExShow[i] = dEx.lunarFestival;         }         else if ("初一" === dEx.lunarDay)         {             pageData.arrInfoExShow[i] = dEx.lunarMonth + "月";         }         else         {             pageData.arrInfoExShow[i] = dEx.lunarDay;         }     }      setCurDetailIndex(offset + day); };  var curDate = new Date(); var curMonth = curDate.getMonth(); var curYear = curDate.getFullYear(); var curDay = curDate.getDay(); refreshPageData(curYear, curMonth, curDay);  Page({     data: pageData,      onLoad: function(options){              },      goToday: function(e){         curDate = new Date();         curMonth = curDate.getMonth();         curYear = curDate.getFullYear();         curDay = curDate.getDay();         refreshPageData(curYear, curMonth, curDay);         this.setData(pageData);     },      goLastMonth: function(e){         if (0 == curMonth)         {             curMonth = 11;             --curYear         }         else         {             --curMonth;         }         refreshPageData(curYear, curMonth, 0);         this.setData(pageData);     },      goNextMonth: function(e){         if (11 == curMonth)         {             curMonth = 0;             ++curYear         }         else         {             ++curMonth;         }         refreshPageData(curYear, curMonth, 0);         this.setData(pageData);     },      selectDay: function(e){         setCurDetailIndex(e.currentTarget.dataset.dayIndex);         this.setData({             detailData: pageData.detailData,         })     },      bindDateChange: function(e){         var arr = e.detail.value.split("-");         refreshPageData(+arr[0], arr[1]-1, arr[2]-1);         this.setData(pageData);     }, });

项目地址及下载:
https://github.com/morningf/weapp-calendar
微信小程序学习用:日历:公历农历转换,calendar-convert weapp-calendar-master.zip (41.32 KB, 下载次数: 454)

小鱼源码网www.51xyyx.com

轻松一刻:

我有二货朋友一枚,捡到一手机,手机壳内附一纸条“ 如果哪天我手机掉了,请归还 ,有重谢,本人号码:139……” 结果我那朋友连续打两天都是正在通话中…… 就跑来跟我讲,我听后似乎明白了什么 。真是两个奇葩!
 下载地址
登录  查看下载地址。

提示:注册,评论,每日签到,点赞可获得积分。

为您推荐

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

联系我们

联系我们

在线咨询: QQ交谈

邮箱: 2805477110@qq.com

周一至周六,8:00-21:00,节假日休息
关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部
切换注册

登录

忘记密码 ?

切换登录

注册