What is the iCAL property for using the user's local time? - timezone

I've created a Power Automate flow that generates an ICS file for a meeting invite that will be sent to people across the US in different time zones.
Everything is working as I had hoped, but I can't find the property that needs to be set in order to use the end user's local time. It always shows up in UTC.

The way that the event's start/stop time is displayed to the end-user depends on how the end-user's calendar program is designed/configured. It has nothing to do with the data in the ICS file.
Google Calendar, for example, will automatically convert from whatever time zone the ICS file uses to the user's local time zone.

Related

Is there a way to find the timezone of a calendar on MS Bookings via Graph Api

Looking through the graph api and I can list appointments with the start time and end time in the calendars time-zone.
Can I find the calendar's time-zone without looking at an existing appointment? I would expect it to be in the bookingBusinesses/{id} resource.
We have several calendars in several timezones and working through an algorithm to figure out available timeslots. Obviously "Day 0" is the worst - no appointment = no timezone data. We can work around it by creating one appointment. Is there a better way though?
You cannot fetch the time zone of the Calendar however you can fetch the time zone of User mailbox that owns the Calendars. AFAIK calendars don't even have their own independent time zone settings but refer the parent user mailbox's time zone setting.
The User.mailboxSettings API can be used to fetch timezone preference of the Calendar
curl -X GET 'https://graph.microsoft.com/v1.0/users/john.smith#contoso.com/mailboxSettings/timeZone'
Here is the official documentation.
https://learn.microsoft.com/en-us/graph/api/resources/mailboxsettings?view=graph-rest-1.0
It is worth noting that the timezone values format follows Windows Timezones. Your programming platform may not be following the same and might be using IANA timezone format, then you would need to translate windows timezone to IANA timezone

handing daily tasks in rails with timezones and DST

In my app, users can select a time that they want to receive a daily email. I then regularly run a script to find users who have an upcoming email to send and send it. So, if users elect to have an email that goes out at 7AM, I look for users with that selected as their time and send it.
The problem is of course timezones. I'm going to have users in different timezones and need 7AM to always be 7AM, regardless of timezones or daylight savings.
I can understand how to do it for display purposes, but I can't find much info on executing queries that have to factor in the timezone and DST for a collection of users with varying times and timezones.
This can probably be most easily accomplished by simply saving everything in the database as UTC. You can adjust the times for display and incoming form data by using the users' specified time zone.

How to get time adjusted to user timezone in Sitecore CMS

I'm using custom command to import data for newly created item in Sitecore. Since there is a lot of data importing, this process is in the background. I send an email with import status once it is completed. I am able to get email from UserProfile:
User currentUser = Sitecore.Context.User;
UserProfile currentProfile = currentUser.Profile;
The problem is that we have import starting time in the email. Since I haven't find where the user time zone is stored, I can't adjust it to match the user time zone.
Do you happen to know if there is any setting to define user time zone from the C# code?
P.S. In the bottom right corner there is a correct time adjusted for the current user, but I didn't find any information on how and where it stored
I'm not sure it's stored (in fact I believe Sitecore stores DateTime relative to the CM server and not the client).
For you to have an accurate timezone for the visitor/customer, you'd need to either ask for it directly (registration prompt or user profile option) or look it up using Geo data from the originating ip (though with VPNs and public access points this becomes increasingly less reliable).
My suggestion would be to store the start time in UTC and (if necessary) let the user know it was started at that time. If a time elapsed is required, perform the calculation before sending the email off--since start time and end time are relative to the server anyways, just let them know it took "5min 30sec" to complete. If they receive the email at 5:08pm (email timestamp) they can do some simple match and assume it was started at 5:03 (or thereabouts).
I believe the time in the bottom right of the Desktop is using the users local system time (most likely using JavaScript) so it is not dependent on their Sitecore user profile.
There doesn't appear to be any timezone information stored against the user profile, the best you can get the is the CultureInfo based on the Regional ISO Code, although this still is not truly accurate for countries with multiple timezones (USA, Canada, Russia, Australia etc).
You could extend the User Profile to add custom properties and store a timezone field, but it is not available by default.
My suggestion would be to list the start time in UTC time, and let the user mentally adjust to their own timezone. This is what I have done previously, esp since servers themselves could be located in any location.

Rails 4 local Time shown according to local time zone

I am working on rails 4 application. I want to show the time for comment I created. If I open the site in india then time should be shown in IST (according to indian standard) and If I am in USA so for the same comment that i made in india time should be shown according to USA time zone.
What do I need to do in my config file for development and production?
Do I need to change anything in database?
Please help me.
Rails always saves times in UTC (universal time), and the server has a setting which tells it which timezone it (the server) is running in.
To show different times to the client, Rails (which runs on the server) will need to know which time zone the client is in. This isn't in a standard request header so you will need to get them to submit the information somehow. Once you know their timezone you can ensure that you always show times to the user using their timezone - there are helpers for this.
Getting their timezone can be done explicitly, eg by giving them a timezone dropdown in their "My Account" page, and then saving that in their user record, and/or by making it more upfront and forcing them to choose one in a popup, if you don't know it.
Or, you can do it for them using Javascript, passing it through in a cookie. See this article for an example of how to do it.
http://thisbythem.com/blog/clientside-timezone-detection/
Well one solution can be to store the time zone of the user in the database, write a filter
around_action in your ApplicationController which would set the Time.zone to the time_zone from the database field.
You might want to look at Time.zone and TimeZone in the rails api
Here is a railscast , you can figure it out from the comments and the github link.

Send local sqlite file to server

I have a database of many users,which i want to store on both locally and on my server.Whenever user updates any information,i successfully updates it in local database using core database. But how to change this information into the server?? I am not getting this please help?
I thinking of sqlite file to server every time user updates his information. but how to send data of sqlite file to server?
Add a column to your local DB that is the last time updated. (I think there may be a way to get SQLite to fill this in semi-automatically for you, but even doing it "manually" is no big deal.) Then, when you want to upload updates, query for rows updated since the last upload. Ship to the server as JSON records.
You can also keep a separate table that tracks updates, but that's for more complex scenarios.
You have to use some tactics for this. Here is a short explanation of this work.
Database Structure
Web service
You have to design database at local and server side and manage flag(Bool) and update time.
Like when you launch app then you have to check your local data and take last update date and send request to server what's new update after this date. If there is any update then you can send data as a result of that webservice and handle that response at local device.
When you do some changes at local device then you have to manage flag, update time and created date. flag will show it has update on server or not. If updated then Y otherwise N. And you have to send created and updated date with this.
During this request you have to manage in a same timezone. You can use standard UTC timezone because there may be chances that User can switch in different timezones so handle this.
If you need more clarification then you can ask at our chat room https://chat.stackoverflow.com/rooms/43424/coders-diary
This approach definitely work for you.

Resources