html5-infobeamer-aalen-geek.../assets/js/custom/services/general.js
2023-11-01 01:59:19 +01:00

57 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
import * as sol from "../../solight/sol.js";
const process_data = (scheduleFile) =>
sol.processScheduleFile(scheduleFile);
const trackIndexMap = new Map([
['Main', 0]]);
const track_index = (track) =>
trackIndexMap.get(track);
const typeIndexMap = new Map([
["Organization", 0],
["Moderation", 1],
["Talk", 2]]);
const type_index = (type) =>
typeIndexMap.get(type);
const person_names_concat = (persons) =>
// persons.map(p => sol.personName(p)).join(', ');
// persons.map(p => sol.personName(p)).join(' & ');
persons.map(p => sol.personName(p)).join(' · ');
const ndash_fix_regexp = RegExp('\\s+-\\s+');
const ndash_fix_replacement = ' ';
const fix_dash = (string) =>
string.replace(ndash_fix_regexp, ndash_fix_replacement);
const is_soon = (then, now, dt) => {
const delta = then.toMillis() - now.toMillis();
return delta >= 0 && delta <= dt * 1000;
};
const is_recent = (then, now, dt) => {
const delta = now.toMillis() - then.toMillis();
return delta >= 0 && delta <= dt * 1000;
};
export {
process_data,
track_index,
type_index,
person_names_concat,
fix_dash,
is_soon,
is_recent
}