bevacqua / rome

:calendar: Customizable date (and time) picker. Opt-in UI, no jQuery!
https://bevacqua.github.io/rome
MIT License
2.91k stars 223 forks source link

Initial value unix epoch #217

Open Tampa opened 1 year ago

Tampa commented 1 year ago

Putting the epoch into the value part of the input I get it converted when I click on the field(not automatically though), but placing it inside initialValue: for rome the input field remains blank. It seems to fetch it fine as soon as I click the field, but doesn't initially populate anything.

<input id="datetime" class="input" data-rome-id="0">

document.addEventListener('DOMContentLoaded', initload, false);

function initload () {
    rome(datetime, { initialValue: '<?php echo $dateUTC; ?>' });
}

What am I doing wrong here?

Tampa commented 1 year ago

I had to solve this by adding the timezone offset from moment to the return form. How is it that it simply cannot "just" convert a unix epoch to that particular time without using javascript's time objects, which get localized. Moment already supports changing timezones to force UTC, so adding an option to rome to force a certain timezone should be relatively easy?

Though it would seem this project isn't maintained anymore? @bevacqua