Results for “date arithmetic”
Small, practical examples. Search by task or narrow things down below.
Validate the number of positional arguments
Bash Scripts: Use the argument count to enforce a simple command-line contract.
Bash Scripts✓ Tested
Validate the shape of an absolute URL
HTML: A URL input checks syntax, not whether a resource exists or is safe.
HTML✓ Tested
Validate UTF-8 bytes
Validate UTF-8 bytes using a complete Go program with explicit sample inputs.
Go✓ Tested
Add calendar days
Use DateOnly for a date without a time zone in C#.
C#✓ Tested
Add calendar days in UTC
JavaScript: Use UTC date setters to cross month boundaries without local daylight-saving effects.
JavaScript✓ Tested
Add calendar days in UTC
TypeScript: Use UTC date setters to cross month boundaries without local daylight-saving effects.
TypeScript✓ Tested
Bound a command execution time
Linux Commands: Use timeout and handle status 124 as an expected time limit.
Linux Commands✓ Tested
Calculate a page count without an overflowing addition
C: Divide first and add one only when a nonzero remainder remains.
C✓ Tested
Calculate a simple total
Python: Multiply a unit price by a quantity, then add a delivery fee.
Python✓ Tested
Calculate a simple total
C#: Multiply a unit price by a quantity, then add a delivery fee.
C#✓ Tested
Calculate a simple total
Java: Multiply a unit price by a quantity, then add a delivery fee.
Java✓ Tested
Calculate a simple total
JavaScript: Multiply a unit price by a quantity, then add a delivery fee.
JavaScript✓ Tested