sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

TimeZoneInfo wrong daylightDate and standardDate

Open mirkori opened this issue 7 years ago • 11 comments

Category

  • [x] Bug

Expected Behavior

TimeZoneInfo on context.pageContext.user should enable me to convert UTC to local time.

e.g. for timezone "(UTC+1) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna" (TimeZoneId 4) daylightDate should be: March 31 2019 02:00 CET

Observed Behavior

TimeZoneInfo returns wrong dates for daylightDate (Day 5 of Month 3) and standardDate (Day 5 of Month 10) . dates are returned as ISPSystemTime

I want to convert UTC to local time. Conversion with the formula from https://docs.microsoft.com/en-us/javascript/api/sp-page-context/sptimezone?view=sp-typescript-latest gives wrong results.

mirkori avatar Jan 24 '19 08:01 mirkori

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar Jan 24 '19 08:01 msft-github-bot

This issue seems to be not only present in the spfx WebPartContext class but also in sync with _spPageContextInfo.userTimeZoneData on classic sites and pages, where the same wrong DaylightDate and StandardDate objects are returned.

mirkori avatar Feb 04 '19 09:02 mirkori

Any updates on this one? Its one week until summer time DST in Europe.

mirkori avatar Mar 25 '19 12:03 mirkori

@mirkori Are you still seeing issues here?

ghost avatar Jul 16 '19 00:07 ghost

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities.

msft-github-bot avatar Jul 23 '19 01:07 msft-github-bot

This issue still exists for probably all timezones.

Daylight Savings for Pacific Time: image _spPageContextInfo.userTimeZoneData: image

mirkori avatar Jul 25 '19 18:07 mirkori

Hey there... is there any progress on this issue? I'm also experiencing the same issue with the incorrect daylightDate (screenshot below):

image

ahessami avatar Apr 08 '20 15:04 ahessami

The calculation of the date is correct, but the daylightDate doesn't have a public documentation, so the values will seem misleading. Here are the some of the non obvious property descriptions for daylightDate: DayOfWeek = 0-6, Sunday - Saturday Day = the Nth DayOfWeek in that month @ahessami that example would be interpreted as the 2nd Sunday of March (March 10th) There will be an update to the public API.

kemesfun avatar Jul 20 '20 18:07 kemesfun

Thank you for the clarification @kemesfun . Should "day" be actually named "weekOfMonth" in this case, to align to the "dayOfWeek" naming?

mirkori avatar Jul 20 '20 19:07 mirkori

@mirkori The variable name change is something we may consider, but whether or not this api will go beyond beta is still unknown.

kemesfun avatar Jul 20 '20 20:07 kemesfun

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jul 28 '20 00:07 msft-github-bot