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

UTC fixes #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/Utils.gs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function getTimeZoneString() {

function convertToUserDate(date) {
var user_timezone_string = getTimeZoneString();
var user_date_string = Utilities.formatDate(date, user_timezone_string, "yyyy/MM/dd HH:mm:ss");
var user_date_string = Utilities.formatDate(date, 'utc', "yyyy/MM/dd HH:mm:ss");
debug('user_date_string: ' + user_date_string)
var user_date = new Date(user_date_string);
debug('Converted:' + date + ' to user time:' + user_date);
return user_date;
Expand Down Expand Up @@ -99,21 +100,19 @@ function getUserChildLabels(label) {



function parseDate(str) {
// return Date.parse(str);
if(dateConversionRequired(str)){
return convertToUserDate(Date.future(str));
}

return Date.future(str);
function parseDate(str) {
debug('parseDate str input: ' + str);
var date = Date.utc.future(str);
debug('parseDate date created from str: ' + date);
return convertToUserDate(date).full();
}

function parseDateFormat(str) {
// var date = Date.parse(str);
var date = Date.future(str);
debug('parseDateFormat string input: ' + str);
var date = Date.utc.future(str);
debug('parseDateFormat date created from str: ' + date);
if (date.isValid() && date.isFuture()) {
return convertToUserDate(date).full();
return convertToUserDate(date).full();
}

return null;
Expand Down