initial commit of the paytime session frontend
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { parseDbDateTime } from './timezone';
|
||||
|
||||
// Parses a MySQL DATETIME string correctly regardless of the Node
|
||||
// process's own timezone — see lib/timezone.ts.
|
||||
export function parseDbDate(s: string): Date {
|
||||
return parseDbDateTime(s);
|
||||
}
|
||||
|
||||
export function diffMinutes(startStr: string, endStr: string | null): number | null {
|
||||
if (!endStr) return null;
|
||||
const start = parseDbDate(startStr);
|
||||
const end = parseDbDate(endStr);
|
||||
return Math.round((end.getTime() - start.getTime()) / 60000);
|
||||
}
|
||||
Reference in New Issue
Block a user