Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
- name: Test JSON and YAML comparison
run: node --test scripts/json-diff.test.cjs

- name: Test timestamp parsing and comparison
run: node --test scripts/timestamp-converter.test.cjs

- name: Validate HTML
uses: Cyb3r-Jak3/html5validator-action@v7.2.0
with:
Expand All @@ -56,6 +59,7 @@ jobs:
yaml-formatter/index.html
json-diff/index.html
crontab/index.html
timestamp-converter/index.html
terraform-modules/index.html
fail: true
jobSummary: true
Expand All @@ -82,4 +86,5 @@ jobs:
http://127.0.0.1:8080/yaml-formatter/
http://127.0.0.1:8080/json-diff/
http://127.0.0.1:8080/crontab/
http://127.0.0.1:8080/timestamp-converter/
http://127.0.0.1:8080/terraform-modules/
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,29 @@ section navigation, and connected page/application/author/image structured data.
links. Follow the crontab checks in [`SEARCH_CONSOLE.md`](./SEARCH_CONSOLE.md)
after deployment to inspect indexing and measure actual search performance.

## Unix Timestamp Converter

Open `/timestamp-converter/` to convert between Unix seconds, Unix
milliseconds, and ISO 8601. See each instant in UTC and a searchable display
time zone. Enter a second timestamp to see the event order, exact elapsed time,
and copyable AWS CloudWatch Logs `--start-time` and `--end-time` flags.

Auto-detect treats numbers with 12 or more digits before the decimal as
milliseconds and shorter numbers as seconds. Choose a unit explicitly for
ambiguous values. ISO dates default to midnight UTC. Date and time inputs
accept `Z`, `UTC`, or a numeric offset, including values copied as JSON strings.
Fractional values retain up to nanosecond precision.
CloudWatch ranges widen to whole milliseconds when needed and start at the Unix
epoch or later. The browser processes all inputs locally.

The conversion engine lives in `timestamp-converter/timestamp.js`. The page
shares the Cron Schedule Builder’s theme and time-zone picker. Run the
conversion and comparison tests with Node.js 22 or later:

```sh
node --test scripts/timestamp-converter.test.cjs
```

## Terraform Modules

Open `/terraform-modules/` to explore public AWS Terraform modules
Expand Down Expand Up @@ -280,6 +303,7 @@ python3 -m http.server 8080
- `http://localhost:8080/yaml-formatter/`
- `http://localhost:8080/json-diff/`
- `http://localhost:8080/crontab/`
- `http://localhost:8080/timestamp-converter/`
- `http://localhost:8080/terraform-modules/`

## Quality and search checks
Expand Down
1 change: 1 addition & 0 deletions SEARCH_CONSOLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ invented or replaced with a placeholder.
- `https://native-cube.com/yaml-formatter/`
- `https://native-cube.com/json-diff/`
- `https://native-cube.com/crontab/`
- `https://native-cube.com/timestamp-converter/`
- `https://native-cube.com/terraform-modules/`
4. Do not submit `/json-formatter/`; it is a redirect alias.

Expand Down
137 changes: 137 additions & 0 deletions assets/time-zone-picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
"use strict";

function setupTimeZonePicker(timeZone, { onInput, onSelect }) {
const picker = timeZone.closest(".timezone-picker");
const toggle = picker.querySelector("button");
const list = document.getElementById(timeZone.getAttribute("aria-controls"));
const matches = picker.querySelector("[role=status]");
const commonZones = ["UTC", "Europe/London", "Europe/Warsaw", "America/New_York", "America/Los_Angeles", "Asia/Kolkata", "Asia/Tokyo", "Australia/Sydney"];
let availableZones = [];
try {
availableZones = typeof Intl.supportedValuesOf === "function" ? Intl.supportedValuesOf("timeZone") : [];
} catch { /* Common choices and manual input remain available. */ }
const zones = [...new Set([...commonZones, ...availableZones])];
let filteredZones = [];
let activeIndex = -1;

function close() {
list.hidden = true;
timeZone.setAttribute("aria-expanded", "false");
timeZone.removeAttribute("aria-activedescendant");
toggle.setAttribute("aria-expanded", "false");
toggle.setAttribute("aria-label", "Show time zones");
matches.textContent = "";
activeIndex = -1;
}

function open(query = "") {
const tokens = query.trim().toLowerCase().replaceAll("_", " ").split(/[\s/]+/).filter(Boolean);
filteredZones = zones.filter((zone) => tokens.every((token) => zone.toLowerCase().replaceAll("_", " ").includes(token)));
activeIndex = -1;
timeZone.removeAttribute("aria-activedescendant");
const fragment = document.createDocumentFragment();
filteredZones.forEach((zone, index) => {
const option = document.createElement("li");
option.id = `${list.id}-${index}`;
option.className = "timezone-option";
option.dataset.zone = zone;
option.dataset.index = index;
option.setAttribute("role", "option");
option.setAttribute("aria-selected", String(zone === timeZone.value.trim()));
option.textContent = zone;
fragment.append(option);
});
if (!filteredZones.length) {
const empty = document.createElement("li");
empty.className = "timezone-empty";
empty.setAttribute("role", "option");
empty.setAttribute("aria-disabled", "true");
empty.textContent = "No matching suggestions. You can still type a full IANA time zone.";
fragment.append(empty);
}
list.replaceChildren(fragment);
list.hidden = false;
list.scrollTop = 0;
timeZone.setAttribute("aria-expanded", "true");
toggle.setAttribute("aria-expanded", "true");
toggle.setAttribute("aria-label", "Hide time zones");
matches.textContent = filteredZones.length ? `${filteredZones.length} time zone${filteredZones.length === 1 ? "" : "s"} available.` : "No matching suggestions. Manual entry is still available.";
}

function activate(index, scroll = true) {
if (!filteredZones.length) return;
activeIndex = Math.max(0, Math.min(index, filteredZones.length - 1));
[...list.children].forEach((option, position) => {
option.classList.toggle("is-active", position === activeIndex);
option.setAttribute("aria-selected", String(position === activeIndex));
});
const option = list.children[activeIndex];
timeZone.setAttribute("aria-activedescendant", option.id);
if (scroll) option.scrollIntoView({ block: "nearest", behavior: "instant" });
}

function choose(zone) {
timeZone.value = zone;
timeZone.focus({ preventScroll: true });
timeZone.setSelectionRange(zone.length, zone.length);
close();
onSelect();
}

function resumeEditing() {
activeIndex = -1;
timeZone.removeAttribute("aria-activedescendant");
[...list.children].forEach((option) => {
option.classList.remove("is-active");
option.setAttribute("aria-selected", String(option.dataset.zone === timeZone.value.trim()));
});
}

timeZone.addEventListener("focus", () => open());
timeZone.addEventListener("click", () => {
if (list.hidden) open();
else resumeEditing();
});
timeZone.addEventListener("input", () => {
open(timeZone.value);
onInput();
});
timeZone.addEventListener("keydown", (event) => {
if (event.isComposing) return;
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
event.preventDefault();
if (event.altKey && event.key === "ArrowUp") { close(); return; }
if (list.hidden) open();
if (!event.altKey) activate(activeIndex < 0 ? event.key === "ArrowDown" ? 0 : filteredZones.length - 1 : activeIndex + (event.key === "ArrowDown" ? 1 : -1));
} else if (event.key === "Enter" && !list.hidden) {
if (activeIndex >= 0) {
event.preventDefault();
choose(filteredZones[activeIndex]);
} else close();
} else if (event.key === "Escape" && !list.hidden) {
event.preventDefault();
close();
} else if (event.key === "Tab") close();
else if (["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) resumeEditing();
});
toggle.addEventListener("mousedown", (event) => event.preventDefault());
toggle.addEventListener("click", () => {
const wasOpen = !list.hidden;
timeZone.focus({ preventScroll: true });
if (wasOpen) close();
else open();
});
list.addEventListener("mousedown", (event) => event.preventDefault());
list.addEventListener("pointermove", (event) => {
const option = event.target.closest("[data-zone]");
if (option && Number(option.dataset.index) !== activeIndex) activate(Number(option.dataset.index), false);
});
list.addEventListener("click", (event) => {
const option = event.target.closest("[data-zone]");
if (option) choose(option.dataset.zone);
});
document.addEventListener("pointerdown", (event) => { if (!picker.contains(event.target)) close(); });
document.addEventListener("focusin", (event) => { if (!picker.contains(event.target)) close(); });
window.addEventListener("blur", close);
return close;
}
138 changes: 1 addition & 137 deletions crontab/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,143 +32,7 @@
let current = null;
let renderTimer;
let toastTimer;
const closeTimeZones = setupTimeZonePicker();

function setupTimeZonePicker() {
const picker = byId("timezone-picker");
const toggle = byId("timezone-toggle");
const list = byId("timezone-options");
const matches = byId("timezone-status");
const commonZones = ["UTC", "Europe/London", "Europe/Warsaw", "America/New_York", "America/Los_Angeles", "Asia/Kolkata", "Asia/Tokyo", "Australia/Sydney"];
let availableZones = [];
try {
availableZones = typeof Intl.supportedValuesOf === "function" ? Intl.supportedValuesOf("timeZone") : [];
} catch { /* Common choices and manual input remain available. */ }
const zones = [...new Set([...commonZones, ...availableZones])];
let filteredZones = [];
let activeIndex = -1;

function close() {
list.hidden = true;
timeZone.setAttribute("aria-expanded", "false");
timeZone.removeAttribute("aria-activedescendant");
toggle.setAttribute("aria-expanded", "false");
toggle.setAttribute("aria-label", "Show time zones");
matches.textContent = "";
activeIndex = -1;
}

function open(query = "") {
const tokens = query.trim().toLowerCase().replaceAll("_", " ").split(/[\s/]+/).filter(Boolean);
filteredZones = zones.filter((zone) => tokens.every((token) => zone.toLowerCase().replaceAll("_", " ").includes(token)));
activeIndex = -1;
timeZone.removeAttribute("aria-activedescendant");
const fragment = document.createDocumentFragment();
filteredZones.forEach((zone, index) => {
const option = document.createElement("li");
option.id = `timezone-option-${index}`;
option.className = "timezone-option";
option.dataset.zone = zone;
option.dataset.index = index;
option.setAttribute("role", "option");
option.setAttribute("aria-selected", String(zone === timeZone.value.trim()));
option.textContent = zone;
fragment.append(option);
});
if (!filteredZones.length) {
const empty = document.createElement("li");
empty.className = "timezone-empty";
empty.setAttribute("role", "option");
empty.setAttribute("aria-disabled", "true");
empty.textContent = "No matching suggestions. You can still type a full IANA time zone.";
fragment.append(empty);
}
list.replaceChildren(fragment);
list.hidden = false;
list.scrollTop = 0;
timeZone.setAttribute("aria-expanded", "true");
toggle.setAttribute("aria-expanded", "true");
toggle.setAttribute("aria-label", "Hide time zones");
matches.textContent = filteredZones.length ? `${filteredZones.length} time zone${filteredZones.length === 1 ? "" : "s"} available.` : "No matching suggestions. Manual entry is still available.";
}

function activate(index, scroll = true) {
if (!filteredZones.length) return;
activeIndex = Math.max(0, Math.min(index, filteredZones.length - 1));
[...list.children].forEach((option, position) => {
option.classList.toggle("is-active", position === activeIndex);
option.setAttribute("aria-selected", String(position === activeIndex));
});
const option = list.children[activeIndex];
timeZone.setAttribute("aria-activedescendant", option.id);
if (scroll) option.scrollIntoView({ block: "nearest", behavior: "instant" });
}

function choose(zone) {
timeZone.value = zone;
timeZone.focus({ preventScroll: true });
timeZone.setSelectionRange(zone.length, zone.length);
close();
render();
}

function resumeEditing() {
activeIndex = -1;
timeZone.removeAttribute("aria-activedescendant");
[...list.children].forEach((option) => {
option.classList.remove("is-active");
option.setAttribute("aria-selected", String(option.dataset.zone === timeZone.value.trim()));
});
}

timeZone.addEventListener("focus", () => open());
timeZone.addEventListener("click", () => {
if (list.hidden) open();
else resumeEditing();
});
timeZone.addEventListener("input", () => {
open(timeZone.value);
queueRender();
});
timeZone.addEventListener("keydown", (event) => {
if (event.isComposing) return;
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
event.preventDefault();
if (event.altKey && event.key === "ArrowUp") { close(); return; }
if (list.hidden) open();
if (!event.altKey) activate(activeIndex < 0 ? event.key === "ArrowDown" ? 0 : filteredZones.length - 1 : activeIndex + (event.key === "ArrowDown" ? 1 : -1));
} else if (event.key === "Enter" && !list.hidden) {
if (activeIndex >= 0) {
event.preventDefault();
choose(filteredZones[activeIndex]);
} else close();
} else if (event.key === "Escape" && !list.hidden) {
event.preventDefault();
close();
} else if (event.key === "Tab") close();
else if (["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) resumeEditing();
});
toggle.addEventListener("mousedown", (event) => event.preventDefault());
toggle.addEventListener("click", () => {
const wasOpen = !list.hidden;
timeZone.focus({ preventScroll: true });
if (wasOpen) close();
else open();
});
list.addEventListener("mousedown", (event) => event.preventDefault());
list.addEventListener("pointermove", (event) => {
const option = event.target.closest("[data-zone]");
if (option && Number(option.dataset.index) !== activeIndex) activate(Number(option.dataset.index), false);
});
list.addEventListener("click", (event) => {
const option = event.target.closest("[data-zone]");
if (option) choose(option.dataset.zone);
});
document.addEventListener("pointerdown", (event) => { if (!picker.contains(event.target)) close(); });
document.addEventListener("focusin", (event) => { if (!picker.contains(event.target)) close(); });
window.addEventListener("blur", close);
return close;
}
const closeTimeZones = setupTimeZonePicker(timeZone, { onInput: queueRender, onSelect: render });

function notify(message) {
clearTimeout(toastTimer);
Expand Down
13 changes: 10 additions & 3 deletions crontab/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
<title>Crontab Generator &amp; Cron Expression Tester | Native Cube</title>
<link rel="stylesheet" href="./styles.css?v=5" />
<script src="./cron.js?v=1" defer></script>
<script src="./app.js?v=3" defer></script>
<script src="../assets/time-zone-picker.js?v=1" defer></script>
<script src="./app.js?v=4" defer></script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
Expand All @@ -76,7 +77,7 @@
"name": "Crontab Generator & Cron Expression Tester | Native Cube",
"description": "Build and test cron expressions online. Preview next runs with time zones and DST, then export crontab, Kubernetes, GitHub Actions, or AWS Scheduler config.",
"inLanguage": "en-GB",
"dateModified": "2026-11-02",
"dateModified": "2026-11-25",
"isPartOf": {
"@id": "https://native-cube.com/#website"
},
Expand Down Expand Up @@ -377,7 +378,13 @@ <h3 id="explanation">Weekdays at 09:30</h3>
<details><summary>Is my schedule sent to a server?</summary><p>No. Parsing, time-zone conversion, and configuration generation happen in your browser. The share button puts the schedule settings in a URL fragment so you can send the link yourself. Anyone with that link can read those settings.</p></details>
</div>
</section>
<aside class="related-tools" aria-label="Related tools"><strong>Keep building.</strong><a href="../yaml-formatter/">Validate YAML &amp; JSON <span aria-hidden="true">↗</span></a><a href="../k8s-manifest-builder/">Build a Kubernetes workload <span aria-hidden="true">↗</span></a><a href="../">Explore all tools <span aria-hidden="true">↗</span></a></aside>
<aside class="related-tools" aria-label="Related tools">
<strong>Keep building.</strong>
<a href="../timestamp-converter/">Convert and compare timestamps <span aria-hidden="true">↗</span></a>
<a href="../yaml-formatter/">Validate YAML &amp; JSON <span aria-hidden="true">↗</span></a>
<a href="../k8s-manifest-builder/">Build a Kubernetes workload <span aria-hidden="true">↗</span></a>
<a href="../">Explore all tools <span aria-hidden="true">↗</span></a>
</aside>
</main>

<footer class="site-footer">
Expand Down
Loading
Loading