Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
christopher-w Posted November 15, 2018 Posted November 15, 2018 IPS 4.3, Digital Ocean standalone, London. Hey, I have created a custom date field in the Pages app but the custom field is rendered in both US and UK formats, depending on where it's viewed. For example, when editing the date (Original Publication Date) in the article it expects a UK date, which is what I want. But when viewed, shown here at the top of the article, it renders in US date format: It also renders in US date format in the listing view. However all other dates appear to render correctly, the issue appears to be restricted to custom date fields. Just to be clear, I am in London and expect the entire site to show UK formatted dates. Or US formatted when viewed in the US. And so on. Have I missed a config setting somewhere? Many thanks Chris
AndyF Posted November 15, 2018 Posted November 15, 2018 Do you have Calendar installed ? If so do the dates format correctly for you (dd/mm/yy) in that compared to (mm/dd/yy) ?
christopher-w Posted November 15, 2018 Author Posted November 15, 2018 Found that I can create custom output in field display section - now just need to find out how to format a date using template language. 40 minutes ago, AndyF said: Do you have Calendar installed ? If so do the dates format correctly for you (dd/mm/yy) in that compared to (mm/dd/yy) ? Thanks, see above:
AndyF Posted November 15, 2018 Posted November 15, 2018 Oh OK. :) I had a vague thought the locale may of been incorrect perhaps in the language settings too. That being said take a look at this: https://invisioncommunity.com/developers/docs/fundamentals/dates-and-times-r165/ I'm not 100% sure how helpful that may or may not be however, I'm not a php dev. Hopefully if its not helpful one of our friendly authors here will be able to chime in with the correct details to use.
bfarber Posted November 15, 2018 Posted November 15, 2018 We use the localeDate() method to pull the custom field value, so it should use whatever locale is in use (caching aside - make sure the field/page/block/whatever isn't getting cached by a user from the US I suppose).
christopher-w Posted November 18, 2018 Author Posted November 18, 2018 On 11/15/2018 at 2:57 PM, bfarber said: We use the localeDate() method to pull the custom field value, so it should use whatever locale is in use (caching aside - make sure the field/page/block/whatever isn't getting cached by a user from the US I suppose). Thanks, I've only got the US locale installed. Currently formatting on the client using moment.js I see locale is set in the language file. How does that work with a user's locale? So, for example, how do I show a UK format date to UK visitors and US format to US? Many thanks Chris
bfarber Posted November 19, 2018 Posted November 19, 2018 Locale is set with the language pack, so you would just create two: one for English (UK) (or en_UK locale) and one for English (US) (or en_US locale). The text strings can be identical, or you can have fun and adjust the strings between the two (changing 's' and 'z' where appropriate for British English and so on, as the pack largely follows US English conventions out of the box).
Recommended Posts
Archived
This topic is now archived and is closed to further replies.