This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Mike Hughes
Posted Mar 30 - Read on Facebook

In the interests of making our protos realistic, is there a way to get the current time from the device/browser ? So I can change for example the iOS status bar with the current time based on the time that the proto is being viewed/run.


Kevyn Arnott

Yeah, you can pretty easily with Javascript Date Reference. You have to create a new date object with something like: date = new Date() and then you can fetch hours calling something like hours = date.getHours(). You do the same for minutes. FYI, you'll have some odd cases to consider too if you want a 12 hour clock since the hours will be 0-23. The more tricky part is you'll need to setup a delegate method that'll update the time every minute because without that it'll only pull on load. I should have a module out really soon that provides all of this and a status bar if you want to wait a bit.

Jordan Robert Dobson

I have a snippet exactly for this. I'll send it your way tomorrow. ;)

Marc Krenn
Unfortunately, I've never had the time to finish this one. Includes a realtime and static clock (24/12h), and you can set the battery percentage. All the stuff on the left side (carrier, Wifi, etc.) isn't in.

Jordan Robert Dobson

Here's a little timer fun with SVG and delays.

Mike Hughes

Thanks guys, I'll play around with these all tonight (hopefully). Will let you know what issues I run into.

Read the entire post on Facebook