ui fix
This commit is contained in:
parent
43d1a72346
commit
5c051bac0c
@ -30,8 +30,7 @@ function getLastDate(dateString) {
|
||||
|
||||
// Check if it is a weekday (Monday to Friday)
|
||||
if (dayOfWeek >= 1 && dayOfWeek <= 5) {
|
||||
// Subtract one day
|
||||
date.setDate(date.getDate() - 1);
|
||||
date.setDate(date.getDate());
|
||||
} else {
|
||||
// Find the last weekday of the week
|
||||
// If it's Saturday, go back to Friday
|
||||
@ -46,19 +45,28 @@ function getLastDate(dateString) {
|
||||
return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
|
||||
}
|
||||
}
|
||||
function formatTime(dateString) {
|
||||
// Parse the date string to a Date object
|
||||
function formatTime(dateString) {
|
||||
// Parse the date string to a Date object
|
||||
const date = new Date(dateString);
|
||||
|
||||
// Extract hours, minutes, and seconds
|
||||
const hours = String(date.getUTCHours()).padStart(2, '0');
|
||||
let hours = date.getUTCHours();
|
||||
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getUTCSeconds()).padStart(2, '0');
|
||||
|
||||
// Format time as hh:mm:ss
|
||||
return `${hours}:${minutes}:${seconds}`;
|
||||
// Determine AM/PM
|
||||
const ampm = hours >= 12 ? 'PM' : 'AM';
|
||||
|
||||
}
|
||||
// Convert hours from 24-hour to 12-hour format
|
||||
hours = hours % 12;
|
||||
hours = hours ? hours : 12; // the hour '0' should be '12'
|
||||
|
||||
// Format hours
|
||||
const formattedHours = String(hours).padStart(2, '0');
|
||||
|
||||
// Format time as hh:mm:ss AM/PM
|
||||
return `${formattedHours}:${minutes}:${seconds} ${ampm}`;
|
||||
}
|
||||
|
||||
function findMostFrequentTicker(data) {
|
||||
const tickerCountMap = new Map();
|
||||
@ -267,7 +275,7 @@ function getLastDate(dateString) {
|
||||
</span>
|
||||
|
||||
<span class="text-white text-sm sm:text-[1rem] italic mt-2 text-center sm:text-start w-full ml-2 mb-5">
|
||||
Live Flow of {displayDate}
|
||||
Live Flow of {displayDate} (NYSE Time)
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
@ -81,6 +81,21 @@
|
||||
|
||||
}
|
||||
|
||||
function formatTime(timeString) {
|
||||
// Split the time string into components
|
||||
const [hours, minutes, seconds] = timeString.split(':').map(Number);
|
||||
|
||||
// Determine AM or PM
|
||||
const period = hours >= 12 ? 'PM' : 'AM';
|
||||
|
||||
// Convert hours from 24-hour to 12-hour format
|
||||
const formattedHours = hours % 12 || 12; // Converts 0 to 12 for midnight
|
||||
|
||||
// Format the time string
|
||||
const formattedTimeString = `${formattedHours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')} ${period}`;
|
||||
|
||||
return formattedTimeString;
|
||||
}
|
||||
|
||||
function handleViewData(optionData) {
|
||||
//optionStart = optionData['Start Date'] === null ? 'n/a' : new Date(optionData['Start Date'])?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' });
|
||||
@ -555,8 +570,8 @@ $: {
|
||||
<div class="w-full m-auto mb-10 bg-[#0F0F0F] pl-3 pr-3">
|
||||
<div class="flex flex-col sm:flex-row items-center w-full">
|
||||
{#if !$isOpen}
|
||||
<span class="text-white text-sm italic mt-5 text-center sm:text-start w-full ml-2 mb-5">
|
||||
Live flow of {new Date(optionList?.at(0)?.date ?? null)?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })}
|
||||
<span class="text-white text-sm sm:text-md italic mt-5 text-center sm:text-start w-full ml-2 mb-5">
|
||||
Live flow of {new Date(optionList?.at(0)?.date ?? null)?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })} (NYSE Time)
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
@ -858,7 +873,7 @@ $: {
|
||||
<tr on:click={() => handleViewData(item)} class="w-full odd:bg-[#202020] cursor-pointer {index+1 === optionList?.length && data?.user?.tier !== 'Pro' ? 'opacity-[0.1]' : ''}">
|
||||
|
||||
<td class="text-white pb-3 text-xs sm:text-sm text-start">
|
||||
{item?.time}
|
||||
{formatTime(item?.time)}
|
||||
</td>
|
||||
|
||||
<th on:click|stopPropagation={() => assetSelector(item?.ticker, item?.assetType)} class="{index % 2 ? 'bg-[#0F0F0F]' : 'bg-[#202020]'} text-blue-400 text-start font-normal">
|
||||
|
||||
@ -72,6 +72,23 @@ function toggleMode()
|
||||
}
|
||||
|
||||
|
||||
function formatTime(timeString) {
|
||||
// Split the time string into components
|
||||
const [hours, minutes, seconds] = timeString.split(':').map(Number);
|
||||
|
||||
// Determine AM or PM
|
||||
const period = hours >= 12 ? 'PM' : 'AM';
|
||||
|
||||
// Convert hours from 24-hour to 12-hour format
|
||||
const formattedHours = hours % 12 || 12; // Converts 0 to 12 for midnight
|
||||
|
||||
// Format the time string
|
||||
const formattedTimeString = `${formattedHours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')} ${period}`;
|
||||
|
||||
return formattedTimeString;
|
||||
}
|
||||
|
||||
|
||||
function handleViewData(optionData) {
|
||||
//optionStart = optionData['Start Date'] === null ? 'n/a' : new Date(optionData['Start Date'])?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' });
|
||||
optionSymbol = optionData?.option_symbol;
|
||||
@ -453,8 +470,8 @@ const debouncedHandleInput = debounce(handleInput, 200);
|
||||
<div class="w-full m-auto mb-10 bg-[#0F0F0F] pl-3 pr-3">
|
||||
<div class="flex flex-col sm:flex-row items-center w-full">
|
||||
{#if !$isOpen}
|
||||
<span class="text-white text-sm italic mt-5 text-center sm:text-start w-full ml-2 mb-5">
|
||||
Live flow of {new Date(optionList?.at(0)?.date ?? null)?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })}
|
||||
<span class="text-white text-sm sm:text-md italic mt-5 text-center sm:text-start w-full ml-2 mb-5">
|
||||
Live flow of {new Date(optionList?.at(0)?.date ?? null)?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })} (NYSE Time)
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
@ -745,9 +762,9 @@ const debouncedHandleInput = debounce(handleInput, 200);
|
||||
<!-- row -->
|
||||
<tr on:click={() => handleViewData(item)} class="w-full odd:bg-[#202020] cursor-pointer {index+1 === optionList?.length && data?.user?.tier !== 'Pro' ? 'opacity-[0.1]' : ''}">
|
||||
|
||||
<td class="text-white pb-3 text-xs sm:text-sm text-start">
|
||||
{item?.time}
|
||||
</td>
|
||||
<td class="text-white pb-3 text-xs sm:text-sm text-start">
|
||||
{formatTime(item?.time)}
|
||||
</td>
|
||||
|
||||
<th on:click|stopPropagation={() => assetSelector(item?.ticker, item?.assetType)} class="{index % 2 ? 'bg-[#0F0F0F]' : 'bg-[#202020]'} text-blue-400 text-start font-normal">
|
||||
{item?.ticker}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user