PageSourceSearch

https://cycle.tools/TVCharts/plugin-examples/helpers/time.js

js cycle.tools collected 2026-09-27 10:38:52 UTC 1,519 bytes, 34 lines download raw bytes

1import { isUTCTimestamp, isBusinessDay } from '../../../lib/lightweight-charts/dist/lightweight-charts.standalone.production.mjs'; //'lib/lightweight-charts/dist/lightweight-charts.standalone.production.js';
2//import { Time } from 'lib/lightweight-charts/dist/lightweight-charts.standalone.production.js';
3export function convertTime(t) {
4    if (isUTCTimestamp(t))
5        return t * 1000;
6    if (isBusinessDay(t))
7        return new Date(t.year, t.month, t.day).valueOf();
8    const [year, month, day] = t.split('-').map(parseInt);
9    return new Date(year, month, day).valueOf();
10}
11export function displayTime(time) {
12    if (typeof time == 'string')
13        return time;
14    const date = isBusinessDay(time)
15        ? new Date(time.year, time.month, time.day)
16        : new Date(time * 1000);
17    return date.toLocaleDateString();
18}
19export function formattedDateAndTime(timestamp) {
20    if (!timestamp)
21        return ['', ''];
22    const dateObj = new Date(timestamp);
23    // Format date string
24    const year = dateObj.getFullYear();
25    const month = dateObj.toLocaleString('default', { month: 'short' });
26    const date = dateObj.getDate().toString().padStart(2, '0');
27    const formattedDate = `${date} ${month} ${year}`;
28    // Format time string
29    const hours = dateObj.getHours().toString().padStart(2, '0');
30    const minutes = dateObj.getMinutes().toString().padStart(2, '0');
31    const formattedTime = `${hours}:${minutes}`;
32    return [formattedDate, formattedTime];
33}
34//# sourceMappingURL=time.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.