Reputation: 83
I am currently trying to grab today's date, but since Date() uses UTC time, is there a library in Bixby that can receive the date according to the user's timezone? The issue is new Date() can sometimes give me the date for the next day.
I've tried using new dates.ZonedDateTime.now(), but then I will have an issue if today was 10/1/2019 and I want to know yesterday's date. With Date(), I would just use
var today = new Date();
today.setDate(today.getDate() - 1);
I can't do that with dates.ZonedDateTime.now(), or at least I am unsure how to.
Upvotes: 0
Views: 57
Reputation: 83
I have found the answer myself.
var today = new dates.ZonedDateTime.now().getDateTime();
var yesterday = new dates.ZonedDateTime.now().minusDays(1).getDateTime();
var yesterdayDay = new dates.ZonedDateTime.now().minusDays(1).getDateTime().date.day;
https://bixbydevelopers.com/dev/docs/reference/JavaScriptAPI/dates
Upvotes: 3