当前位置:网站首页>正则校验与时间格式化
正则校验与时间格式化
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
}
边栏推荐
- 浅谈一下跨端技术方案
- Plato launched the LAAS protocol elephant swap, which allows users to earn premium income
- [unity] configure unity edit C as vscode
- B-tree~
- How to carry out engineering implementation of DDD Domain Driven Design
- 进程和线程知识点总结1
- RHCE命令练习(二)
- Educational Codeforces Round 132 (Rated for Div. 2)【A~C】
- ActiveMQ basic details
- Day2: 130 questions in three languages
猜你喜欢

面试突击69:TCP 可靠吗?为什么?

深度学习 | MATLAB实现TCN时间卷积神经网络spatialDropoutLayer参数描述

MySQL stored procedure realizes the creation of a table (copy the structure of the original table and create a new table)

时序预测 | MATLAB实现TCN时间卷积神经网络的时间序列预测

solidity实现智能合约教程(5)-NFT拍卖合约

Wechat campus bathroom reservation applet graduation design finished product (5) assignment

The method of tracking the real-time market of London Silver

B-tree~

Tupu software appeared at the 2022 Fuzhou digital Expo to jointly create a new digital era
![[web development] basic knowledge of flask framework](/img/79/5ece84552c82e98f5e15fac1ee3335.png)
[web development] basic knowledge of flask framework
随机推荐
Machine learning | matlab implementation of RBF radial basis function neural network Newrbe parameter setting
Method of converting inline elements to block elements
小程序毕设作品之微信校园浴室预约小程序毕业设计成品(6)开题答辩PPT
Connect with Alipay payment
Spark 3.0 中七个必须知道的 SQL 性能优化
“index [hotel/jXLK5MTYTU-jO9WzJNob4w] already exists“
solidity实现智能合约教程(5)-NFT拍卖合约
【commons-lang3专题】003- RandomStringUtils 专题
小程序毕设作品之微信校园浴室预约小程序毕业设计成品(5)任务书
Summary of process and thread knowledge points 1
The method of tracking the real-time market of London Silver
Interview shock 69: is TCP reliable? Why?
写作作业一
Deep learning | matlab implementation of TCN time convolution neural network spatialdropoutlayer parameter description
日期转换 EEE MMM dd HH:mm:ss zzz yyyy
Prometheus 的 API 稳定性保障
Five interesting magic commands in jupyter notebook
【刷题笔记】从链表中删去总和值为零的连续节点
dart数组,Map,类型判断,条件判断运算符,类型转换
[Jenkins' notes] introduction, free space; Continuous integration of enterprise wechat; Allure reports, continuous integration of email notifications; Build scheduled tasks