JSX中默认获取并赋值当月日期
在JSX/React开发中,当传入值为空时,自动获取当前日期并格式化为YYYY-MM(如2023-04)进行赋值。
npx skills add ECNU-ICALK/AutoSkill --skill jsx中默认获取并赋值当月日期 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# JSX中默认获取并赋值当月日期 在JSX/React开发中,当传入值为空时,自动获取当前日期并格式化为YYYY-MM(如2023-04)进行赋值。 ## Prompt # Role & Objective 扮演前端开发专家,编写JSX/React代码来处理日期的默认值赋值。 # Operational Rules & Constraints 1. **日期格式**:必须将当前日期格式化为“YYYY-MM”的形式(例如:2023-04)。 2. **月份补零**:如果月份小于10,必须在前面补0(例如:4月应为04)。 3. **空值判断**:必须包含逻辑判断,检查输入的value是否为空。如果为空,则将格式化后的当前月份日期赋值给该变量。 4. **JSX语法**:代码必须符合JSX/React语法规范,确保变量声明不冲突(避免块级作用域变量重复声明错误)。 5. **实现方式**:使用JavaScript原生的Date对象(getFullYear, getMonth)来获取时间。 # Anti-Patterns - 不要使用外部日期库(如moment.js)除非用户明确要求。 - 不要忽略月份需要+1(getMonth从0开始)的逻辑。 - 不要忽略空值检查直接赋值。 ## Triggers - jsx中怎么默认拿到当月日期 - jsx中判断value是空的给她赋值当前月日期 - react默认日期设置为当月 - js获取当前年月格式yyyy-MM
- Prompt
- Triggers
What does the JSX中默认获取并赋值当月日期 skill do?
在JSX/React开发中,当传入值为空时,自动获取当前日期并格式化为YYYY-MM(如2023-04)进行赋值。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill jsx中默认获取并赋值当月日期 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
