On Sunday, December 30, 2012, Brion Vibber wrote: > On Sat, Dec 29, 2012 at 6:41 AM, Nischay Nahata > <[email protected]<javascript:;> > >wrote: > > > I could find a method to covert a timestamp into the user preferred > > timezone in the Language class; Looks like the wrong place to me. > > Is there any other way (think global function) to convert to the user's > > timezone and preferred format? > > > > Date formatting is language-based, so the date formatting functions do > indeed live in Language. It's also based on user preferences, which makes > it a bit of an odd fit, but it's a legit localization thing. :) > > Elsewhere in the code, timestamps are passed around in timezone-independent > formats based on UTC. > > Also, is there any common script to do this in JS? > > > > With reference to bug 43365 > > > > I'm not sure if we have full localization for dates in JS... > > Thankfully to the i18n team it seems to be in development now; as per comment https://bugzilla.wikimedia.org/show_bug.cgi?id=38079#c5
...but you can use the browser's built-in support. You won't get the same > formatting, and it may not match the user's *time zone preference* in > MediaWiki... > > eg > > https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleString > > -- brion > _______________________________________________ > Wikitech-l mailing list > [email protected] <javascript:;> > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > -- Cheers, Nischay Nahata nischayn22.in _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
