Comments (12)
Welcome to US-RSE! We are excited that this is your first issue!
from usrse.github.io.
I think you meant to say "but the calendar entry is created for noon Central time."
from usrse.github.io.
I did, corrected, sorry and thank you @danielskatz!
from usrse.github.io.
From the non-minimized code posted in PR#1058, if you call the addToCalendar
function and specify in the data a timezone, it ultimately uses this function n
and adjusts the original date/time that you provided to offset it. For example, I am in Central timezone, if you pass "America/New_York", it will subtract an hour from the date that it gets. I think this is the problem - it explains why when I download a calendar it is an hour off.
n = function(e, t) {
if (e) {
if (t) {
var a = new Date(e.toLocaleString("en-US", {
timeZone: t
})),
A = e.getTime() - a.getTime();
return new Date(e.getTime() + A)
}
return e
}
},
I think the solution is to remove line 28 from _includes/buttons/add-to-calendar-button.html
https://github.com/USRSE/usrse.github.io/blob/main/_includes/buttons/add-to-calendar-button.html#L28
// Event timezone. Will convert the given time to that zone
timezone: "America/New_York",
I can see why this parameter was included, the documentation for this plugin we're using (I think this is the right one): https://www.addevent.com/documentation/add-to-calendar-button recommends providing it. However, we provide our dates/times in UTC, so I don't think any adjustment is needed.
Local testing after removing that timezone
parameter showed events being created with the correct time with this change applied. Am happy to proceed with PR, but wanted to first ask if anyone with more historical knowledge of the site can say if this will break something that I'm not thinking of?
from usrse.github.io.
From the non-minimized code posted in PR#1058, if you call the
addToCalendar
function and specify in the data a timezone, it ultimately uses this functionn
and adjusts the original date/time that you provided to offset it. For example, I am in Central timezone, if you pass "America/New_York", it will subtract an hour from the date that it gets. I think this is the problem - it explains why when I download a calendar it is an hour off.n = function(e, t) { if (e) { if (t) { var a = new Date(e.toLocaleString("en-US", { timeZone: t })), A = e.getTime() - a.getTime(); return new Date(e.getTime() + A) } return e } },
I think the solution is to remove line 28 from
_includes/buttons/add-to-calendar-button.html
https://github.com/USRSE/usrse.github.io/blob/main/_includes/buttons/add-to-calendar-button.html#L28// Event timezone. Will convert the given time to that zone timezone: "America/New_York",
I can see why this parameter was included, the documentation for this plugin we're using (I think this is the right one): https://www.addevent.com/documentation/add-to-calendar-button recommends providing it. However, we provide our dates/times in UTC, so I don't think any adjustment is needed.
Local testing after removing that
timezone
parameter showed events being created with the correct time with this change applied. Am happy to proceed with PR, but wanted to first ask if anyone with more historical knowledge of the site can say if this will break something that I'm not thinking of?
@lrasmus Great catch! I tested this change locally and everything seems to work on my local setup. This should not affect anything other than the button this file creates. So, should be safe to modify.
My only potential concern is if someone has their calendar app setup to use a different timezone by default than what the browser thinks, we may still run into some conflicts. It may be worth trying to set this timezone variable with the same timezone that is used for the timezone string that appears in events. In other words, maybe using something similar to code in _includes/events/event-time.html
, specifically line 16 - var tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
This file is what sets the time stamp we put before the "Add to Calendar" button.
from usrse.github.io.
Actually, if you simply replace line 28 with timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
instead of timezone: "America/New_York",
it seems to get the correct timezone and states that in at least Google Calendar.
By removing the timezone line entirely, I was not seeing a timezone stated in Google Calendar, which I think would result in it defaulting to whatever the individual's Google Calendar is set too. And 99% of the time, I'm sure that would be the timezone the browser would also think. But seems worth enforcing it to match what the event's page states above the button.
from usrse.github.io.
Thank you @exoticDFT, it's a great suggestion and it seems to work in my local testing too. Do you want to make the change/PR with suggested fix? I feel like you're the one who really "solved" this, and I would hate to take credit unfairly.
from usrse.github.io.
@lrasmus feel free to make the PR with that change, if you would like. I would have never looked into it without you recognizing the problem in the first place. I'd say this is definitely yours to claim 🙂
from usrse.github.io.
Let's go ahead and do this, then we can also merge #1055 and delete #1058 (unless we resolve this through that)
from usrse.github.io.
@danielskatz - this incorporates the fix from @exoticDFT for the calendar issue. I agree to delete #1058 and if we're good with everything here we can get #1055 merged.
from usrse.github.io.
@lrasmus - It feels a bit wrong to me to have these fairly different changes in the same PR in terms of someone wanting to look at the calendar code in the future. I was expecting a new PR for that, that we would merge, then we would create the new events by merging #1055.
What do you think? I could be convinced this way is ok too...
from usrse.github.io.
I'm good with whatever is preferred - I can definitely see the logic behind 2 PR and separation
from usrse.github.io.
Related Issues (20)
- Add a page on RSE internship opportunities HOT 2
- New data source for membership counts
- Recommended format for listing times in multiple timezones HOT 4
- Adding speaker series HOT 4
- Add style guide to README HOT 1
- Make preview links on PRs more prominant? HOT 2
- Add wikipedia links to skills? HOT 1
- Facebook and LinkedIn "Share buttons" on blog posts are broken HOT 4
- Footnotes font size is too small to read comfortably HOT 1
- Make transparency log easier to find HOT 2
- Add link to YouTube Channel in Footer HOT 4
- Make Affinity Groups Easier to Find
- Should we use the all-contributors bot on this site? HOT 1
- Change titles/text on repeating community call events so they don't look like duplicates HOT 1
- Allow future posts, maybe just for some collections?
- Issue with CircleCI previews HOT 1
- meta post on 2022 Community Building Workshop that links to all other posts HOT 2
- The menu bar is wider than the minimum width which makes the support and join buttons invisible at some widths HOT 2
- Show election candidates in varying order 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 usrse.github.io.