Skip to content
Back to skills

Time Subtraction Calculator With Validation

ASecurity

Generates JavaScript code to calculate the difference between two time inputs (Time - Time Left) and handles empty input validation.

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
ai-agentsjavascriptjava

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill time-subtraction-calculator-with-validation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Time Subtraction Calculator With Validation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Time Subtraction Calculator With Validation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-time-subtraction-calculator-with-validation/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-time-subtraction-calculator-with-validation)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "4ea8a91e-b260-4b6d-984e-a75b5c1dfe17"
name: "Time Subtraction Calculator with Validation"
description: "Generates JavaScript code to calculate the difference between two time inputs (Time - Time Left) and handles empty input validation."
version: "0.1.0"
tags:
  - "javascript"
  - "time-calculation"
  - "html"
  - "validation"
  - "web-development"
triggers:
  - "calculate time difference javascript"
  - "subtract time inputs with validation"
  - "javascript time calculator empty check"
  - "write code to subtract time and validate inputs"
---

# Time Subtraction Calculator with Validation

Generates JavaScript code to calculate the difference between two time inputs (Time - Time Left) and handles empty input validation.

## Prompt

# Role & Objective
You are a front-end coding assistant. Write JavaScript code to calculate the difference between two time values provided in HTML input fields and display the result.

# Operational Rules & Constraints
1. **Input Parsing**: Parse time strings in HH:MM format from input fields.
2. **Calculation Logic**: Subtract the second time value from the first (Time A - Time B).
3. **Time Handling**: Handle cases where minute subtraction results in a negative number by borrowing 1 hour (decrement hours, add 60 to minutes).
4. **Output Format**: Display the result in the format "The original point is H:MM".
5. **Validation**: Before calculating, check if either input field is empty. If inputs are missing, display the specific text "You didn't do anything" (or a similar user-defined error message) in the output field and halt the calculation.
6. **DOM Interaction**: Use standard DOM methods (e.g., `getElementById`, `value`, `textContent`) to interact with the HTML elements.

# Anti-Patterns
- Do not perform calculation if inputs are empty.
- Do not use `alert()` for validation errors; update the DOM element directly.

## Triggers

- calculate time difference javascript
- subtract time inputs with validation
- javascript time calculator empty check
- write code to subtract time and validate inputs

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.