For HTML datetime-local input, can i split their limits to date and time individually?
<input type="datetime-local" min="2020-12-20T10:00" max="2020-12-25T10:00">
Hi guys, i am trying to split the min and max values for date and time, for example, 2020 Dec 10 to 2020 Dec 15, 10am-8pm on all of these aforementioned dates. How can I do that? Can i do so without splitting into 2 input types? Thanks
See also questions close to this topic
-
Hiding some items while the specific items pops on mouse hover . how? i am practicing making a dropdown menu
i want a subMenu appear as mouse hover on products while the other items(Home & Contact) hidden on mouse hover. i'm practicing making a dropdown menu using html and css. this is what i've tried
.products:hover .menuBar>li:nth-child(odd) { display: none;}
any help.. thanks
this is my code:
body { font-size: 18px; } li { text-decoration: none; list-style: none; } .menuBar { position: relative; display: flex; justify-content: space-between; background-color: green; width: 700px; padding: 20px; margin: 0 auto; } .subMenu { display: none; } .products:hover .subMenu { display: flex; justify-content: space-between; position: absolute; width: 40%; left: 25%; } .products:hover .menuBar>li:nth-child(odd) { display: none; }
<body> <ul class="menuBar"> <li>Home</li> <li class="products">Products <ul class="subMenu"> <li>Product A</li> <li>Product B</li> <li>Product C</li> </ul> </li> <li>Contact</li> </ul> </body>
-
Why doesn't my video show an image before pressing play on mobile devices
So there's no background image before playing a video on this website I made on mobile devices. This is the code I'm using in HTML
<div class="row " > <div class="col-12 text-center"> <video controls> <source src="image3/video.mov" type="video/mp4"> <source src="image3/video.mov" type="video/ogg"> </video> </div> </div>
This runs fine on my laptop it's just on my phone that shows no background image of the video before pressing play.
-
WhatsApp/Facebook link preview not working (but seems scraped correctly)
The Facebook/WhatsApp preview isn't working for one website I have and I'm currently at a loss of what could be missing. I already tried everything on other posts.
Besides title, description, favicon and x-ua-compatible I currently have the following OG properties:
<meta property="og:url" content="https://markas.pt" /> <meta property="og:title" content="markas | plataforma de marcas portuguesas" /> <meta property="og:description" content="Plataforma de marcas Portuguesas com dados abertos para o objetivo de divulgação e promoção do que é nacional" /> <meta property="og:site_name" content="markas.pt" /> <meta property="og:image" content="http://www.markas.pt/ogimage_redux.jpg" /> <meta property="og:image:secure_url" content="https://www.markas.pt/ogimage_redux.jpg" /> <meta property="og:image:width" content="256" /> <meta property="og:image:height" content="256" /> <meta property="og:image:alt" content="markas.pt" /> <meta property="og:image:type" content="image/jpeg" /> <meta property="og:type" content="website" /> <meta property="og:locale" content="pt_PT" />
Here's what I've tried:
- Change og:image to 1200x630 resolution and/or in PNG
- Remove og:image:secure_url and other og:image subproperties
- Add "itemprop=image" to og:image property
It seems to be correctly scraped by Facebook as the sharing debugger shows the preview. But in WhatsApp/Facebook still doesn't show up. I only have a warning for lacking fb:app_id but I know of other websites that don't have it and have link preview.
Anyone knows what could be missing?
-
Fallback countdown timer to be set to same day/time every week
If the user sets a date on the backend (via jQuery DateTimer Picker) the following
acf_vars.timer
variable would look like this on the frontend:2021 2 9 13 08 00
I have the following construct as a countdown timer (CODEPEN):
const [y, month, d, h, minute, s] = acf_vars.timer.split(' '); // monthIndex in Date Object begins with 0, so we subtract 1 const countDownDate = new Date(y, month - 1, d, h, minute, s).getTime(); const updateCountdown = () => { const now = new Date().getTime(); // Get today's date and time const distance = countDownDate - now; // Find distance between now and the countdown date const expiredTimer = distance <= 0; let days = Math.floor(distance / (1000 * 60 * 60 * 24)); let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); let seconds = Math.floor((distance % (1000 * 60)) / 1000); if (expiredTimer) { days = hours = minutes = seconds = 0; clearInterval(timerInterval); } document.querySelectorAll('.ticker').forEach((container) => { container.children[0].classList.contains('days') && (container.children[0].textContent = days); container.children[2].classList.contains('hours') && (container.children[2].textContent = hours); container.children[4].classList.contains('minutes') && (container.children[4].textContent = minutes); container.children[6].classList.contains('seconds') && (container.children[6].textContent = seconds); }); }; const timerInterval = setInterval(updateCountdown, 1000); updateCountdown();
If the user doesn't specify a future date on the backend, I'd like to use a fallback which automatically sets the countdown timer to the upcoming Sunday at 9am. To solve this I tried setting a standardized
countDownDate
variable but I'm having trouble coming up with a way to set the day and time to automatically be the upcoming Sunday at 9am. -
Show full range on scale_x_date even with zero values
I'm struggling with displaying a graph with dates on the x-axis. I want it to show a specific range of dates even if some dates have no values. Here's an example:
library(ggplot2) df <- data.frame( Identifier = c("A", rep("B", 3), "C"), Date = c(rep(as.Date("2021-01-12"), 2), as.Date("2021-01-14"), as.Date("2021-01-15"), as.Date("2021-01-13")), n = c(1, 1, 2, 1, 1) ) MaxDate = as.Date("2021-01-21") ggplot(data = df, aes(x=Date, y=n, fill=Identifier)) + geom_bar(stat = "identity") + scale_x_date(name=NULL, date_labels = "%d\n%b", breaks = seq(from = MaxDate-9, to = MaxDate, by = "1 day"), date_breaks = "day")
This produce a graph but won't show any days after 15-Jan, even though I provided the range with breaks and seq function. I thought of providing the limits, but then it doesn't show the values for 12-Jan for some reason:
ggplot(data = df, aes(x=Date, y=n, fill=Identifier)) + geom_bar(stat = "identity") + scale_x_date(name=NULL, date_labels = "%d\n%b", breaks = seq(from = MaxDate-9, to = MaxDate, by = "1 day"), date_breaks = "day", limits = c(MaxDate-9, MaxDate))
-
Get number of consecutive occurrences by date according to specific criteria
I have a dataframe of stock data that was obtained with the following code:
from pandas_datareader import data import datetime as dt start=dt.datetime(2017, 1, 1) end=dt.datetime.today() df = data.DataReader('IBM', 'yahoo', start, end) df['Change'] = df.Close.pct_change()
What I would like to do is search through the data and find consecutive days when the stock went up by a given percentage. I would like to do this by setting the number of consecutive days and seeing if anything is returned. So, for example, 4+ days in a row where the stock is up by >2%.
It's easy enough to filter by df.Close.pct_change() > 0.02, but how do I filter by 4 or more consecutive days?
The dataframe basically looks like this.
print(df.head()) High Low Open Close Volume \ Date 2017-01-03 167.869995 166.009995 167.000000 167.190002 2934300.0 2017-01-04 169.869995 167.360001 167.770004 169.259995 3381400.0 2017-01-05 169.389999 167.259995 169.250000 168.699997 2682300.0 2017-01-06 169.919998 167.520004 168.690002 169.529999 2945500.0 2017-01-09 169.800003 167.619995 169.470001 167.649994 3189900.0 Adj Close Change Date 2017-01-03 139.613220 NaN 2017-01-04 141.341766 0.012381 2017-01-05 140.874130 -0.003309 2017-01-06 141.567230 0.004920 2017-01-09 139.997330 -0.011090
I'm looking for code that will yield something like this:
Change Date 2018-02-01 0.0237 2018-02-02 0.0352 2018-02-03 0.0218 2018-02-04 0.0493
In other words, 4 (or more) consecutive days where the change was >= 0.02.
-
How do I convert a JSON DateTime format to a C# DateTime format from an API call
I'm currently building a project that retrieves API data and saves it into a database. Everything is working fine except for the DateTime values in the API. I have a class that uses RestSharp to obtain the API data then it uses NewtonSoft.Json to derserialize the API data into a JSON format which is then stored into a temporary DTO class file. Here is the API method.
public static void getAllRequestData() { var client = new RestClient("[My API URL]"); var request = new RestRequest(); var response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { string rawResponse = response.Content; AllRequests.Rootobject result = JsonConvert.DeserializeObject<AllRequests.Rootobject>(rawResponse); } }
Now here is the DTO file (AllRequests) that will temporarily store the Converted JSON data.
public class AllRequests { public class Rootobject { public Operation Operation { get; set; } } public class Operation { public Result Result { get; set; } public Detail[] Details { get; set; } } public class Result { public string Message { get; set; } public string Status { get; set; } } public class Detail { [Key] public int Id { get; set; } public string Requester { get; set; } public string WorkOrderId { get; set; } public string AccountName { get; set; } public string CreatedBy { get; set; } public string Subject { get; set; } public string Technician { get; set; } public string IsOverDue { get; set; } public string DueByTime { get; set; } public string Priority { get; set; } public string CreatedTime { get; set; } public string IgnoreRequest { get; set; } public string Status { get; set; } } }
The lines of code in Details that I want to be DateTime formats are "DueByTime" and "CreatedTime" instead of being String values. Currently they're only holding JSON format DateTime values in a String such as "1477394860065".
I've tried making "public string CreatedTime { get; set; }" to "public DateTime CreatedTime { get; set; }" However that only returned an error since it's JSON format. How could I rectify this issue so that it's stored in the DTO correctly in a DateTime format? Because ideally I want to scaffold this class file into a table so it can hold data in a database.
For more context to this, here's what I want rectified in my Database.
I want there to be a DateTime shown instead of a long list of numbers like there is here under Createby and DueBy.
Any help would be appreciated.
-
How this "2020-12-31T02:00:00+05:30" string response be convert to 31/12/2020, 02:00 pm in Android Studio?
I am calling a soap webservice and in response I am getting a date, which in the format of "2020-12-31T02:00:00+05:30".
I want to convert it and display it as "31/12/2020, 02:00 AM". How can I do it?
I have tried the below code, but it return's null.
String pattern = "yyyy-MM-dd'T'HH:mm:ss z"; SimpleDateFormat format = new SimpleDateFormat(pattern); try { startDate= format.parse(eventStartDate); } catch (ParseException e) { e.printStackTrace(); }
Any help would be appreciated. Thanks
-
How do I set the tick marks for the end of the month in Matplotlib
I have a list of dates that fall on the end of each month, and I would like for the gridlines and labels of my plot to coincide with these dates. Currently I can only get the chart to plot at the beginning of the month. Is there a way to force Matplotlib to use the end of month values in its charting?
import matplotlib.pyplot as plt from datetime import datetime from matplotlib.dates import MonthLocator from matplotlib.dates import DateFormatter dts = [datetime(2020, 11, 30), datetime(2020, 12, 31), datetime(2021, 1, 31), datetime(2021, 2, 28), datetime(2021, 3, 31), datetime(2021, 4, 30), datetime(2021, 5, 31), datetime(2021, 6, 30), datetime(2021, 7, 31), datetime(2021, 8, 31), datetime(2021, 9, 30), datetime(2021, 10, 31), datetime(2021, 11, 30), datetime(2021, 12, 31), datetime(2022, 1, 31), datetime(2022, 2, 28),] vals = [2000, 2500, 3000, 4000, 4500, 4000, 3000, 2500, 4000, 4500, 3000, 2500, 6000, 4000, 3000, 5000] figsize=(3, 6) fig, ax = plt.subplots(figsize=figsize) ax.xaxis.set_major_locator(MonthLocator((3, 6, 9, 12))) fmt = DateFormatter("%Y-%m") ax.xaxis.set_major_formatter(fmt) ax.plot(dts, vals, color = 'blue') ax.grid(True) plt.show()