Comments (5)
Cannot reproduce on desktop/mobile Chrome and on Firefox. Could you tell me what's your browser and system locale?
from attractions.
Mozilla/5.0, Gecko/20100101 Firefox/85.0 -- for what it's worth, I can reproduce on mobile (Safari). Maybe it's a locale based bug? I'm in USA
from attractions.
I also couldn't reproduce on Firefox 84 or 85.0.2, and my locale is also set to en-US
. I have no access to Safari to test it there, though.
from attractions.
Very interesting, thanks for the comments guys... I looked deeper into the calendar component and datetime utils, and the main issue boils down to the setMonth
functionality on JS Date.
const foo = new Date(0);
foo.setFullYear(2021, 1); // setMonth is used by setFullYear implementation as well
console.log(foo);
We expect this return a Date object for February 1st, and when I run this code in a UTC node container, I get the expected result: 2021-02-01T00:00:00.000Z
. But when I run the exact same code locally in node (15.8.0) or in my browser, the result is 2021-03-04T00:00:00.000Z
.
First: I'm thinking maybe the way we create the day cursor, using new Date(0)
, is failing in non UTC environments (I am in Mountain Standard Time). But this should only account for at maximum 1 day difference.
Here's the other problem, from what I understand. When the date is, for example, January 31 2021, and we setMonth
to February, it becomes February 31 2021 -- which then becomes sometime in the first week of March 2021, since there is no February 31. This messes up the rest of getCalendar logic downstream.
I have identified a fix for these behaviors. When using setMonth
or setFullYear
to change the month value, ensure that we also pass a date value in at the same time. Also create day cursor using new Date()
and not new Date(0)
.
- Here is a PR to fix the behavior in the datetime-utils: #244
And February now displays normally :-) ...Sorry, I am a MM.DD.YYYY weirdo.
from attractions.
It was confusing to me how these links are relevant when the date today is the 15th (or 14th for you), and especially that new Date(0)
should return the epoch (1970.01.01
), irrelevant of the current timezone (I was wrong!). Turns out that the timezone actually affects even that constructor, so I tried changing my timezone to US/Pacific (the one available in DevTools) and running new Date(0)
, and it indeed gave me 1969.12.31
!
Thank you for pointing this out, I'll review the PR now.
P.S.: I can get used to MM.DD.YYYY
, but I've never seen a locale where the week starts on Friday!
from attractions.
Related Issues (20)
- Font is missing HOT 7
- How to use custom fonts for e.g. FormFields? HOT 4
- Add Advanced Documentation for the AccordionSection Element HOT 2
- SvelteKit support HOT 4
- :global() isn't processed in SvelteKit, some styles aren't applied HOT 7
- Up and running HOT 3
- chip-group.scss has an invalid selector :global HOT 3
- Custom table header / table items content? HOT 3
- kebab case for custom elements HOT 5
- Install can't trace down stylesheets HOT 6
- Is illright.me down? (Attractions main documentation source) HOT 2
- CSS media breakpoints support? HOT 1
- svelte-preprocess 5 is available HOT 3
- There are links to broken doc site pages HOT 1
- Input value disappears on drag&drop HOT 8
- Vite HOT 6
- Docs HOT 1
- DatePicker shows different month than the selected on specific dates HOT 3
- Button Ripple performance HOT 1
- Slider produces errors on mobile devices HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from attractions.