first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
@@ -0,0 +1,7 @@
/**
* Format a date object to a localized time string using the browser's default locale
* @param date - Input date to format
* @param showSeconds - Whether to show seconds in the formatted string
* @param useHour12 - Whether to use 12-hour time
*/
export declare const formatTimeString: (date: Date, showSeconds?: boolean, useHour12?: boolean) => string;
+19
View File
@@ -0,0 +1,19 @@
/**
* Format a date object to a localized time string using the browser's default locale
* @param date - Input date to format
* @param showSeconds - Whether to show seconds in the formatted string
* @param useHour12 - Whether to use 12-hour time
*/
export var formatTimeString = function (date, showSeconds, useHour12) {
var localeTimeString = date.toLocaleTimeString([], {
hour: 'numeric',
minute: '2-digit',
second: showSeconds ? '2-digit' : undefined,
hour12: useHour12,
});
if (!useHour12 && localeTimeString.slice(0, 2) === '24') {
localeTimeString = '00' + localeTimeString.slice(2);
}
return localeTimeString;
};
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["timeFormatting/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,IAAU,EAAE,WAAqB,EAAE,SAAmB;IACrF,IAAI,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE;QACjD,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;QAC3C,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACxD,gBAAgB,GAAG,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["/**\n * Format a date object to a localized time string using the browser's default locale\n * @param date - Input date to format\n * @param showSeconds - Whether to show seconds in the formatted string\n * @param useHour12 - Whether to use 12-hour time\n */\nexport const formatTimeString = (date: Date, showSeconds?: boolean, useHour12?: boolean): string => {\n let localeTimeString = date.toLocaleTimeString([], {\n hour: 'numeric',\n minute: '2-digit',\n second: showSeconds ? '2-digit' : undefined,\n hour12: useHour12,\n });\n\n if (!useHour12 && localeTimeString.slice(0, 2) === '24') {\n localeTimeString = '00' + localeTimeString.slice(2);\n }\n\n return localeTimeString;\n};\n"]}