Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix and improve timezone related functions #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

automationai
Copy link

get the default timezone via CalendarApp to fix the issue
change the 1st param of formatDate() from 'message' to 'date' unlock the limitation

get the default timezone via CalendarApp to fix the issue
change the 1st param of formatDate() from 'message' to 'date' unlock the limitation
* @param {string} format
* @param {string} timezone
* @return {string} Formatted date
*/
function formatDate(message, format, timezone) {
function formatDate(date, format, timezone) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change from 'message' to 'date' to unlock the limitation

@@ -500,8 +500,8 @@ function defaults_(options, defaults) {
* @return {string}
*/
function localTimezone_() {
var timezone = new Date().toTimeString().match(/\(([a-z0-9]+)\)/i);
return timezone.length ? timezone[1] : 'GMT';
var timezone = CalendarApp.getDefaultCalendar().getTimeZone();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use CalendarApp to get default timezone to fix the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant