当前位置:网站首页>Get the week start time and week end time of the current date
Get the week start time and week end time of the current date
2022-07-07 22:18:00 【Belden wind】
Native js Get the start time and end time of the week
/** * Get the week start time and week end time of the current date * @example * getWeekDate(new Date()) =>{ weekStartDate: new Date(), weekEndDate: new Date() } */
export const getWeekDate = (date: Date, format?: (date: Date) => string) => {
const nowDayOfWeek = date.getDay() - 1; // Today is the third day of the week
const nowDay = date.getDate(); // Current day
const nowMonth = date.getMonth(); // The current month
const nowYear = date.getFullYear(); // The current year
const weekStartDate = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek);
const weekEndDate = new Date(nowYear, nowMonth, nowDay + (6 - nowDayOfWeek));
return {
weekStartDate: format ? format(weekStartDate) : weekStartDate,
weekEndDate: format ? format(weekEndDate) : weekEndDate,
};
};
边栏推荐
- EasyCVR配置中心录像计划页面调整分辨率时的显示优化
- 双塔模型的最强出装,谷歌又开始玩起“老古董”了?
- operator
- 嵌入式开发:如何为项目选择合适的RTOS?
- 解决uni-app中uni.request发送POST请求没有反应。
- 23. Merge K ascending linked lists -c language
- Jerry's manual matching method [chapter]
- 使用 CustomPaint 绘制基本图形
- How to realize the movement control of characters in horizontal game
- Customer case | China law network, through observing the cloud, greatly shortens the time of fault location
猜你喜欢

Open source OA development platform: contract management user manual
![[open source] Net ORM accessing Firebird database](/img/a2/4eff4f0af53bf3b9839a73019a212f.png)
[open source] Net ORM accessing Firebird database
![Jerry's test box configuration channel [chapter]](/img/d4/fb67f5ee0fe413c22e4e5cd5037938.png)
Jerry's test box configuration channel [chapter]

An in-depth understanding of fp/fn/precision/recall

Px4 autonomous flight

【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式

Ad domain group policy management
![Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cyclic functions [chapter]](/img/14/1c8a70102c106f4631853ed73c4d82.png)
Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cyclic functions [chapter]

嵌入式开发:如何为项目选择合适的RTOS?

ByteDance Android interview, summary of knowledge points + analysis of interview questions
随机推荐
Navicat connect 2002 - can't connect to local MySQL server through socket '/var/lib/mysql/mysql Sock 'solve
Restapi version control strategy [eolink translation]
Backup tidb cluster to persistent volume
如何实现横版游戏中角色的移动控制
L2: current situation, prospects and pain points of ZK Rollup
强化学习-学习笔记9 | Multi-Step-TD-Target
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
OpenGL configure assimp
Code of "digital image processing principle and Practice (matlab version)" part2[easy to understand]
PKPM 2020 software installation package download and installation tutorial
South China x99 platform chicken blood tutorial
MIT6.S081-Lab9 FS [2021Fall]
Jerry's about TWS pairing mode configuration [chapter]
Node:504 error reporting
NVR hard disk video recorder is connected to easycvr through the national standard gb28181 protocol. What is the reason why the device channel information is not displayed?
The maximum number of meetings you can attend [greedy + priority queue]
Index summary (assault version)
Kaggle-Titanic
[azure microservice service fabric] how to transfer seed nodes in the service fabric cluster
[advanced MySQL] index details (I): index data page structure