{"version":3,"file":"generate-time-options.mjs","names":[],"sources":["../../../src/time-picker/generate-time-options.ts"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\nexport const generateTimeOptions = (\n  is24Hour: boolean,\n  interval: number,\n  showSeconds?: boolean,\n) => {\n  const times: string[] = [];\n  const safeInterval = interval || 30;\n  // The dropdown lists times at the minute interval; when seconds are shown the\n  // options are anchored at `:00` and the user can type a more precise value.\n  const secondsSuffix = showSeconds === true ? ':00' : '';\n  for (let minute = 0; minute < 1440; minute += safeInterval) {\n    const hours = Math.floor(minute / 60);\n    const minutes = minute % 60;\n    if (is24Hour) {\n      times.push(\n        `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}${secondsSuffix}`,\n      );\n    } else {\n      const period = hours < 12 ? 'AM' : 'PM';\n      const adjustedHours = hours % 12 || 12;\n      times.push(\n        `${String(adjustedHours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}${secondsSuffix} ${period}`,\n      );\n    }\n  }\n  return times;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,uBACX,UACA,UACA,gBACG;CACH,MAAM,QAAkB,CAAC;CACzB,MAAM,eAAe,YAAY;CAGjC,MAAM,gBAAgB,gBAAgB,OAAO,QAAQ;CACrD,KAAK,IAAI,SAAS,GAAG,SAAS,MAAM,UAAU,cAAc;EAC1D,MAAM,QAAQ,KAAK,MAAM,SAAS,EAAE;EACpC,MAAM,UAAU,SAAS;EACzB,IAAI,UACF,MAAM,KACJ,GAAG,OAAO,KAAK,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,OAAO,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,eAC1E;OACK;GACL,MAAM,SAAS,QAAQ,KAAK,OAAO;GACnC,MAAM,gBAAgB,QAAQ,MAAM;GACpC,MAAM,KACJ,GAAG,OAAO,aAAa,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,OAAO,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,cAAc,GAAG,QACnG;EACF;CACF;CACA,OAAO;AACT"}