当前位置:网站首页>正则校验与时间格式化
正则校验与时间格式化
2022-07-28 23:58:00 【黑白两客】
// 日期回显
export function formatTime(data,famet='YYYY-MM-DD HH:MMM:SS') {
if(famet == 'YYYY-MM-DD HH:MMM:SS'){
const time = new Date(data)
const year = time.getFullYear()
const month = time.getMonth() + 1
const day = time.getDate()
const hour = time.getHours()
const minute = time.getMinutes()
const second = time.getSeconds()
return year + '-' + month + '-' + day
}
}
// 校验
export function reg(data) {
//你输入的手机号长度或格式错误
let reg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{
8}$/
// 姓名格式校验
let reg = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{
2,6}$/;
//身份证号校验
let reg = /^[1-9]\d{
7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{
3}$|^[1-9]\d{
5}[1-9]\d{
3}((0\d)|(1[0-2]))
if (!reg.test(data)) {
uni.showToast({
title: "你输入的手机号长度或格式错误",
icon: 'none'
});
return false
}
return true
}
边栏推荐
- 用CDO进行nc数据的不规则裁剪
- Dart array, map, type judgment, conditional judgment operator, type conversion
- How to deal with the time, scope and cost constraints in the project?
- Machine learning | matlab implementation of RBF radial basis function neural network Newrbe parameter setting
- In the second round, 1000 okaleido tiger were sold out in one hour after logging in to binance NFT again
- 新一代超安全蜂窝电池,思皓爱跑上市,13.99万起售
- 【Leetcode-滑动窗口问题】
- Copy the table in word to wechat as a picture and send it
- State compression DP Mondrian's dream
- Mathematical modeling and detailed explanation of basic knowledge (common knowledge points of Chemistry)
猜你喜欢
随机推荐
RHCE命令练习(二)
How to deal with the time, scope and cost constraints in the project?
[raspberry pie] how does the windows computer connect with raspberry pie
Connect with Alipay payment
Definition of double linked list~
Transfer: cognitive subculture
B- 树 ~
Time series prediction | MATLAB realizes time series prediction of TCN time convolution neural network
如何给女友讲明白JS的bind模拟实现
Beginner's Guide to electronic bidding
转:认知亚文化
Seven marketing strategies of NFT project
[unity] configure unity edit C as vscode
Inftnews | yuanuniverse shopping experience will become a powerful tool to attract consumers
Wechat campus bathroom reservation applet graduation design finished product (8) graduation design thesis template
(完美解决)为什么在train/val/test数据集上用train模式效果都很好,但是在eval模式下全部很差
小程序毕设作品之微信校园浴室预约小程序毕业设计成品(6)开题答辩PPT
大页内存原理及使用设置
Interview shock 69: is TCP reliable? Why?
system verilog常用语法









