FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
frontend-app-learning/src/utils.ts at master · openedx/frontend-app-learning · GitHub
openedx
/
frontend-app-learning
Public
Notifications
You must be signed in to change notification settings
Fork
337
Star
70
Code
Issues
61
Pull requests
33
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
frontend-app-learning
/
src
/
utils.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
12 lines (12 loc) · 458 Bytes
Breadcrumbs
frontend-app-learning
/
src
/
utils.ts
Copy path
File metadata and controls
12 lines (12 loc) · 458 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
/**
* Utility function for appending the browser timezone to the url
* Can be used on the backend when the user timezone is not set in the user account
*/
export
const
appendBrowserTimezoneToUrl
=
(
url
:
string
)
=>
{
const
browserTimezone
=
Intl
.
DateTimeFormat
(
)
.
resolvedOptions
(
)
.
timeZone
;
const
urlObject
=
new
URL
(
url
)
;
if
(
browserTimezone
)
{
urlObject
.
searchParams
.
append
(
'browser_timezone'
,
browserTimezone
)
;
}
return
urlObject
.
href
;
}
;
Back
|
FazBrowse Home
|
New Git URL