js日期库moment
发表于|更新于
|浏览量:
健全的身体比金子还珍贵,强壮的体魄比享用不尽的财富还有价值。——佚名
https://github.com/moment/moment
用于解析、验证、操作和格式化日期的 JavaScript 日期库。
文档:
使用非常简单
1 | npm install moment |
1 | var moment = require('moment'); // require |
或者
1 | import moment from 'moment'; |
解析时间
1 | var day = moment("1995-12-25"); |
格式化时间:
1 | moment("12-25-1995", "MM-DD-YYYY"); |
相关推荐
2022-08-31
资源路径与blobUrl互转
害怕树敌的人永远得不到真正的朋友——哈兹里特 首先是普通资源URL转换为blobUrl 12345678910111213// 生成blobURLconst xhr = new XMLHttpRequest();xhr.open('GET', 'https://VampireAchao.github.io/imgs/preview/3356_3.jpg', true);xhr.responseType = 'blob';xhr.onload = function (e) { if (this.status == 200) { var blob = this.response; console.log(blob); // document.getElementById("myImg").src = URL.createObjectURL(blob); console.log(URL.createObjectURL(bl...
2024-02-16
ant design blazor
帮人要帮心,帮心要知心,知心要诚心。——伊索 分享一个ant design出品的Blazor库 https://antblazor.com/zh-CN/ GitHub - ant-design-blazor/ant-design-blazor: 🌈A set of enterprise-class UI components based on Ant Design and Blazor WebAssembly. Blazor是用于.net构建web应用的框架 https://github.com/dotnet/blazor GitHub - dotnet/aspnetcore: ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
2020-06-30
jQuery的ajax
今天公司实习生问我jQuery的ajax怎么写,这玩意不是很简单吗 12345678910111213$.ajax({ url: "/cowBeer", //url method: "post", //请求方式 contentType: "application/json", //参数类型 data: JSON.stringify({ //这里面是参数 "name":"cowBeer" }), success: function (res) { console.log(res); //处理返回的数据 }, error: function (res) { //错误处...
2021-08-06
代码方式引入iconfont图标
只有永远躺在泥坑里的人,才不会再掉进坑里。——黑格尔 前端开发中,经常会遇到需要引用图标的情况 我们可以在iconfont寻找我们需要的图标 https://www.iconfont.cn/ 比如这两个图标,我非常喜欢,我可以使用直接下载的方式引入图标 但这种方式,如果我们需要它改变颜色的话,就需要再次下载,非常麻烦 我们还可以使用代码方式引入,我们首先点击添加进购物车 然后到我们的购物车结算 点击添加至项目 登录账号 然后再次点击添加至项目后会弹出加入项目,我们可以新建一个项目 确定后,我们就可以在这里点击生成代码 然后复制代码 粘贴到项目css中 然后定义使用iconfont的样式 123456.iconfont{ font-family:"iconfont" !important; font-size:16px;font-style:normal; -webkit-font-smoothing: antialiased; -webkit-text-stroke-width: 0.2px; -m...
2023-05-18
高版本node运行低版本项目
三思而后行——《论语》 这里是运行apache-shenyu的前端项目报错,因为我的node版本过高 https://github.com/apache/shenyu 前端仓库:https://github.com/apache/shenyu-dashboard 除了使用node版本管理工具nvm、或者直接降级node版本以外,还可以配置环境变量 1$env:NODE_OPTIONS="--openssl-legacy-provider" 来让其兼容
2024-10-29
typescript-exercises(三)
青年人的教育是国家的基石。——富兰克林 题面: 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970/*Intro: Since we already have some of the additional information about our users, it's a good idea to output it in a nice way.Exercise: Fix type errors in logPerson function. logPerson function should accept both User and Admin and should output relevant information according to the input: occupation for User an...

阿超
我的名字叫阿超 年龄25岁 家在北京市 职业是软件开发 每天最晚也会在八点前回家 不抽烟 酒浅尝辄止 晚上十二点上床 保证睡足八个小时 睡前写一篇博客 再做二十分钟俯卧撑暖身 然后再睡觉 基本能熟睡到天亮 像婴儿一样不留下任何疲劳和压力 就这样迎来第二天的早晨 健康检查结果也显示我很正常 我想说明我是一个不论何时都追求内心平稳的人 不拘泥于胜负 不纠结于烦恼 不树立使我夜不能寐的敌人 这就是我在这社会的生活态度
Follow Me公告
This is my Blog