Hope you're well. 🎩
I find YouTube's date-trimming on video thumbnails rather amusing.
I did it back then with my close-enough vibe. But recently, when I compared it to actual YouTube frontend, hm... 🤔 That's different. Nifty, that.
Analysis
As I've observed, the pattern goes like this:
- 0 day = 0 day.
- 1 day = 1 day.
- 2 days = 2 days.
- ...
- 6 days = 1 week.
- 7 days = 1 week.
- 8 days = 1 week.
- 9 days = 1 week.
- ...
- 12 days = 2 weeks.
- 13 days = 2 weeks.
- 14 days = 2 weeks.
- ...
- 1 month, 2 weeks, X days = 2 months.
⬆️ See the pattern?
The trimming logic goes as such:
In one sentence:
Largest unit plus half or more of the next lower unit equals one full increment of the largest unit.
Or...
Once the little bit's halfway there or more, give the big lad a bump and forget the small one ever happened.
🤔
Well, that. Is called street mathematics. We have Street Hawk, the heat-seeking laser put on modified Honda-Yamaha and this.
DEMONSTRATION
Information about the application below:
- The YEAR-MONTH-DATE inputs are automatically filled with today's date. You may change each one to get different result.
- Hit
Enter(orReturn) or the button▶️ CALCULATEto calculate the difference. - Tick the
✅ SIMPLEto get the simplified (rounded) output. Untick it to get the detailed result. - Hit
🔄️ RESETto empty the output and fill the inputs with current date.
⬇️ Ready when you are.
Greetings, I'm a demonstration. Please try me.
⬆️ We can try our birthdays or other dates prior today.
The ✅ SIMPLE checkbox, when ticked / unticked, will automatically recalculate the duration.
MAIN FUNCTION
This is the function. You may evaluate and use this.
Pardon for the lack of semicolons.
Changes Roll
-
👷 2025-11-06- Added TRIMMED / DETAILED note for the output.
- Added input and now dates for the output.
- Updated
diffInMs < 0condition block.
Call 🤳
To get simplified output, call it like so:
To get detailed output, call it like so:
CSS: Resizing and Colouring Checkbox
This element:
We can do this:
🙋♂️
Did you know "arvo" means "afternoon"? Oh, kiwis. You might think the anteater? It's aardvark.
It was pure early colonial Dutch (what became Afrikaans). Aard = earth (the soil), vark = pig, "earth pig". Fascinating, aye? Aardvarken.
Or not. 🤷♂️
See ya this arvo, Arvo the aardvark with an Afro.
She sells sea aardvark in the arvo.
Did you know kiwi is both the flora and the fauna? 🧐
By they way, Nena didn't sing "Denk an dich und flagen fliegen" at the end of 99 Luftballons. Believe me. There's no German phrase, Ach ja... flagen fliegen! Not until now. "By they way". See that? Flagen fliegen.
Cheers. 🎩



Comments
Post a Comment