Commit 2e6331da authored by Clint.Network's avatar Clint.Network

Implement MomentJS

parent 5820508c
......@@ -32,6 +32,7 @@ namespace Stratis.Guru.Services
public async Task StartAsync(CancellationToken cancellationToken)
{
Console.WriteLine(TimeZone.CurrentTimeZone.StandardName.ToString());
JackpotCounter();
await InitLotteryAsync();
await CalculateNextDrawAsync();
......@@ -60,11 +61,12 @@ namespace Stratis.Guru.Services
private async Task CalculateNextDrawAsync()
{
DateTime today = DateTime.Today;
DateTime today = DateTime.UtcNow;
int daysUntilFriday = ((int)DayOfWeek.Friday - (int)today.DayOfWeek + 7) % 7;
_nextDraw = today.AddDays(daysUntilFriday);
_nextDraw = DateTime.UtcNow;
var nextDrawTimestamp = ((DateTimeOffset)_nextDraw).ToUnixTimeSeconds();
//TODO: set to 8pm
await _draws.InitDrawAsync(nextDrawTimestamp);
......
......@@ -139,8 +139,8 @@
<recaptcha-script/>
<script src="~/lib/jquery-countdown/dist/jquery.countdown.min.js"></script>
<script src="~/lib/jquery-ajax-unobtrusive/dist/jquery.unobtrusive-ajax.min.js"></script>
<script src="~/lib/moment/min/moment.min.js"></script>
<script src="~/lib/moment/min/moment-with-locales.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment-with-locales.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.4.0/moment-timezone-with-data-2010-2020.min.js"></script>
<script type="text/javascript">
function PaymentSuccess()
{
......@@ -163,9 +163,11 @@
<text>$("#deposit-modal").modal({backdrop: 'static', keyboard: false});</text>
}
$('#clock').countdown('@((DateTimeOffset.FromUnixTimeSeconds((long)ViewBag.NextDraw)).ToString("yyyy/MM/dd HH:mm:ss"))', function(event) {
var nextYear = moment.tz("@((DateTimeOffset.FromUnixTimeSeconds((long)ViewBag.NextDraw)).ToString("yyyy-MM-dd 20:00"))", "Europe/London");
$('#clock').countdown(nextYear.toDate(), function(event) {
$(this).html(event.strftime('%D days %Hh %Mm %Ss'));
});
@*'@((DateTimeOffset.FromUnixTimeSeconds((long)ViewBag.NextDraw)).ToString("yyyy/MM/dd HH:mm:ss"))'*@
})
</script>
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment