Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-01-08 08:10:16

matteo
Member
Registered: 2013-12-19
Posts: 26

Date Picker Custom Field

Is possible to change the set of Custom field data picker in date.js?
I would like to change Date.format = ‘dd/mm/yyyy’; in Date.format = ‘yyyy/mm/dd’;

Matteo

Offline

#2 2014-01-08 10:00:18

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,356
GitHub

Re: Date Picker Custom Field

You can use posted and modified to output the date of an article in any strftime format you like, so yyyy/mm/dd could be achieved like this:

<txp:posted format="%Y/%m/%d" />

and

<txp:modified format=""%Y/%m/%d" />

You can use this in articles or forms. I haven’t tested the code, so I am not 100% sure if the / characters need to be escaped.

Offline

#3 2014-01-08 10:59:42

monicahu
Member
From: Sydney NSW
Registered: 2009-03-07
Posts: 69

Re: Date Picker Custom Field

Tested OK on my site. Learned a new thing again.


Monica
Life with God is the purpose.

Offline

#4 2014-01-08 11:01:30

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,356
GitHub

Re: Date Picker Custom Field

Two tag links for your information: posted and modified

Offline

#5 2014-01-08 13:13:45

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: Date Picker Custom Field

matteo wrote #277909:

Is possible to change the set of Custom field data picker in date.js?

Most likely, you’re satisfied with Pete’s answers, Matteo. Small rest chance: “date.js” sounds like you’re using a plugin for entering/formatting the date, it’s not comprised “out of the box”. I don’t remember which one uses date.js but there’s certainly a spot in the plugin help or the accompanying documentation that mentions the date formatting possibilities.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2014-01-08 16:30:16

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: Date Picker Custom Field

The glz_custom_fields plugin uses date.js. You can change the format here, lines 78-89:

/**
 * The format that string dates should be represented as (e.g. 'dd/mm/yyyy' for UK, 'mm/dd/yyyy' for US, 'yyyy-mm-dd' for Unicode etc).
 *
 * @name format
 * @type String
 * @cat Plugins/Methods/Date
 * @author Kelvin Luck
 */
Date.format = 'dd/mm/yyyy';
//Date.format = 'mm/dd/yyyy';
//Date.format = 'yyyy-mm-dd';
//Date.format = 'dd mmm yy';

Offline

#7 2014-01-09 10:36:06

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Date Picker Custom Field

Matteo! You got to be more specific in your questions!

Offline

#8 2014-01-09 17:55:12

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Date Picker Custom Field

msd_admin_datepicker let’s you configure the date format to be populated into the custom field.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

Board footer

Powered by FluxBB