Skip to content

Commit

Permalink
Adds a note on default timezone; minor reorganization
Browse files Browse the repository at this point in the history
  • Loading branch information
abhshkdz committed Jul 11, 2019
1 parent 5fd7a55 commit 3ffef8b
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 17 deletions.
38 changes: 28 additions & 10 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1>
</div>
<div class="meta col-xs-12">
{{ site.description }}.
To add/update a conference, <a target="_blank" href="//github.com/{{ site.github_username }}/{{ site.github_repo }}">send in a pull request</a>.
To add/edit a conference, <a target="_blank" href="//github.com/{{ site.github_username }}/{{ site.github_repo }}">send in a pull request</a>.
</div>
</div>
<br>
Expand All @@ -56,7 +56,15 @@ <h1>
</div>
<div class="row">
<div class="meta col-xs-12">
Export all deadlines to <a href="https://calendar.google.com/calendar/r?cid={{ site.url }}/ai-deadlines.ics">Google Calendar</a> or <a href="/ai-deadlines.ics">.ics</a>.
<span class="local-timezone-hide">
All deadlines are shown in <span class="local-timezone">America/New_York</span> time.
To view them in conference website timezones, click on the title.
</span>
</div>
<div class="meta col-xs-12">
You can optionally export all deadlines to
<a href="https://calendar.google.com/calendar/r?cid={{ site.url }}/ai-deadlines.ics">Google Calendar</a> or
<a href="/ai-deadlines.ics">.ics</a>.
</div>
</div>
</div>
Expand Down Expand Up @@ -107,9 +115,6 @@ <h1>
<a href="/">{{ site.domain }}</a> is maintained by <a href="//twitter.com/{{ site.twitter_username }}">@{{ site.twitter_username }}</a>.<br>
If you find it useful, consider <a title="_blank" href="https://www.buymeacoffee.com/abhshkdz">buying him a coffee</a>.
</div>
<div class="col-xs-12 col-sm-6">
All deadlines in <span class="local-timezone"></span> time<br><br>
</div>
</div>
</footer>
<br><br>
Expand All @@ -135,8 +140,15 @@ <h1>
}
}
addUtcTimeZones();
var local_timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
$('.local-timezone').text(local_timezone.toString());

try {
var local_timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
$('.local-timezone').text(local_timezone.toString());
}
catch(err) {
$('.local-timezone-hide').hide();
}


// Get all subs
var conf_type_data = {{ site.data.types | jsonify }};
Expand All @@ -157,14 +169,20 @@ <h1>
// adjust date according to deadline timezone
var timezone = {% if conf.timezone %}"{{conf.timezone}}" {% else %} "America/New_York" {% endif %};
var confDate = moment.tz("{{conf.deadline}}", timezone);
// convert deadline to local timezone
var localConfDate = moment.tz(confDate, local_timezone);

// render countdown timer
$('#{{conf.id}} .timer').countdown(confDate.toDate(), function(event) {
$(this).html(event.strftime('%D days %Hh %Mm %Ss'));
});
$('#{{conf.id}} .deadline-time').html(localConfDate.toString());

// convert deadline to local timezone
try {
var localConfDate = moment.tz(confDate, local_timezone);
$('#{{conf.id}} .deadline-time').html(localConfDate.toString());
}
catch(err) {
console.log("Error converting to local timezone.");
}

// add calendar button
var myCalendar = createCalendar({
Expand Down
43 changes: 36 additions & 7 deletions _pages/conference.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,26 @@ <h1>
</div>
<div class="meta deadline col-xs-12">
<span id="conf-date"></span>. <span id="conf-place"></span>.<br>
Deadline (conf. timezone): <span class="deadline-time"></span><br>
Deadline (local timezone): <span class="deadline-local-time"></span><br>
Website: <a id="conf-website" target="_blank" nohref></a><br>
</div>
<div class="meta deadline col-xs-12 col-md-5">
Deadline in timezone from conference website:
</div>
<div class="meta deadline col-xs-12 col-md-6">
<span class="deadline-time"></span>
</div>
<span class="local-timezone-hide">
<div class="meta deadline col-xs-12 col-md-5">
Deadline in your local <span class="local-timezone">America/New_York</span> timezone:
</div>
<div class="meta deadline col-xs-12 col-md-6">
<span class="deadline-local-time"></span>
</div>
</span>
<div class="meta deadline col-xs-2 col-sm-1 col-md-5">
Website:
</div>
<div class="meta deadline col-xs-10 col-sm-11 col-md-7">
<a id="conf-website" target="_blank" nohref></a><br>
</div>
</div>
</div>
Expand Down Expand Up @@ -75,7 +92,13 @@ <h1>
}
}
addUtcTimeZones();
var local_timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
try {
var local_timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
$('.local-timezone').text(local_timezone.toString());
}
catch(err) {
$('.local-timezone-hide').hide();
}

{% for conf in site.data.conferences %}
if (conf == "{{ conf.id }}") {
Expand All @@ -95,15 +118,21 @@ <h1>
// adjust date according to deadline timezone
var timezone = {% if conf.timezone %}"{{conf.timezone}}" {% else %} "America/New_York" {% endif %};
var confDate = moment.tz("{{conf.deadline}}", timezone);
// convert deadline to local timezone
var localConfDate = moment.tz(confDate, local_timezone);

// render countdown timer
$('#conf-timer').countdown(confDate.toDate(), function(event) {
$(this).html(event.strftime('%D days %Hh %Mm %Ss'));
});
$('.deadline-time').html(confDate.toString());
$('.deadline-local-time').html(localConfDate.toString());

// convert deadline to local timezone
try {
var localConfDate = moment.tz(confDate, local_timezone);
$('.deadline-local-time').html(localConfDate.toString());
}
catch(err) {
console.log("Error converting to local timezone.");
}
{% endif %}
}
{% endfor %}
Expand Down

0 comments on commit 3ffef8b

Please sign in to comment.