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)
|
// Check if it is a weekday (Monday to Friday)
|
||||||
if (dayOfWeek >= 1 && dayOfWeek <= 5) {
|
if (dayOfWeek >= 1 && dayOfWeek <= 5) {
|
||||||
// Subtract one day
|
date.setDate(date.getDate());
|
||||||
date.setDate(date.getDate() - 1);
|
|
||||||
} else {
|
} else {
|
||||||
// Find the last weekday of the week
|
// Find the last weekday of the week
|
||||||
// If it's Saturday, go back to Friday
|
// If it's Saturday, go back to Friday
|
||||||
@ -51,13 +50,22 @@ function getLastDate(dateString) {
|
|||||||
const date = new Date(dateString);
|
const date = new Date(dateString);
|
||||||
|
|
||||||
// Extract hours, minutes, and seconds
|
// 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 minutes = String(date.getUTCMinutes()).padStart(2, '0');
|
||||||
const seconds = String(date.getUTCSeconds()).padStart(2, '0');
|
const seconds = String(date.getUTCSeconds()).padStart(2, '0');
|
||||||
|
|
||||||
// Format time as hh:mm:ss
|
// Determine AM/PM
|
||||||
return `${hours}:${minutes}:${seconds}`;
|
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) {
|
function findMostFrequentTicker(data) {
|
||||||
@ -267,7 +275,7 @@ function getLastDate(dateString) {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="text-white text-sm sm:text-[1rem] italic mt-2 text-center sm:text-start w-full ml-2 mb-5">
|
<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>
|
</span>
|
||||||
|
|
||||||
</div>
|
</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) {
|
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' });
|
//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="w-full m-auto mb-10 bg-[#0F0F0F] pl-3 pr-3">
|
||||||
<div class="flex flex-col sm:flex-row items-center w-full">
|
<div class="flex flex-col sm:flex-row items-center w-full">
|
||||||
{#if !$isOpen}
|
{#if !$isOpen}
|
||||||
<span class="text-white text-sm italic mt-5 text-center sm:text-start w-full ml-2 mb-5">
|
<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' })}
|
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>
|
</span>
|
||||||
{/if}
|
{/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]' : ''}">
|
<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">
|
<td class="text-white pb-3 text-xs sm:text-sm text-start">
|
||||||
{item?.time}
|
{formatTime(item?.time)}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<th on:click|stopPropagation={() => assetSelector(item?.ticker, item?.assetType)} class="{index % 2 ? 'bg-[#0F0F0F]' : 'bg-[#202020]'} text-blue-400 text-start font-normal">
|
<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) {
|
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' });
|
//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;
|
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="w-full m-auto mb-10 bg-[#0F0F0F] pl-3 pr-3">
|
||||||
<div class="flex flex-col sm:flex-row items-center w-full">
|
<div class="flex flex-col sm:flex-row items-center w-full">
|
||||||
{#if !$isOpen}
|
{#if !$isOpen}
|
||||||
<span class="text-white text-sm italic mt-5 text-center sm:text-start w-full ml-2 mb-5">
|
<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' })}
|
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>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@ -746,7 +763,7 @@ const debouncedHandleInput = debounce(handleInput, 200);
|
|||||||
<tr on:click={() => handleViewData(item)} class="w-full odd:bg-[#202020] cursor-pointer {index+1 === optionList?.length && data?.user?.tier !== 'Pro' ? 'opacity-[0.1]' : ''}">
|
<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">
|
<td class="text-white pb-3 text-xs sm:text-sm text-start">
|
||||||
{item?.time}
|
{formatTime(item?.time)}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<th on:click|stopPropagation={() => assetSelector(item?.ticker, item?.assetType)} class="{index % 2 ? 'bg-[#0F0F0F]' : 'bg-[#202020]'} text-blue-400 text-start font-normal">
|
<th on:click|stopPropagation={() => assetSelector(item?.ticker, item?.assetType)} class="{index % 2 ? 'bg-[#0F0F0F]' : 'bg-[#202020]'} text-blue-400 text-start font-normal">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user