Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-09-12 11:06:17

david@druna.cz
Member
Registered: 2017-07-25
Posts: 18

Expiration datepicker

Is there a datepicker for expiration date somewhere? Feels cumbersome to type into the separated fields for year, month… by hand. Haven’t found any plugin solving this yet.

Offline

#2 2017-09-12 11:38:17

etc
Developer
Registered: 2010-11-11
Posts: 2,248
Website

Re: Expiration datepicker

That would be a reasonable core feature, especially with future custom fields. Will investigate on jQuery UI side and report back.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#3 2017-09-12 12:15:17

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,122
Website

Re: Expiration datepicker

etc wrote #306964:

That would be a reasonable core feature, especially with future custom fields. Will investigate on jQuery UI side and report back.

The JQ-ui date picker widget was once tried in Core (Write panel) – quite a long time ago (pre 4.6, IIRC maybe philwareham remembers). However it had very poor keyboard accessibility (the user was locked between the date input field and the trigger button, I think) and the feature was backed-out. But maybe as a plugin? The default theme already has all the styling required.

Offline

#4 2017-09-12 16:22:14

etc
Developer
Registered: 2010-11-11
Posts: 2,248
Website

Re: Expiration datepicker

You can try this plugin, it seems to work ok for me:

# Name: etc_datepicker v0.2.2 
# Type: Admin plugin
# 
# Author: 
# URL: 
# Recommended load order: 5

# .....................................................................
# This is a plugin for Textpattern CMS - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

YToxMTp7czo0OiJuYW1lIjtzOjE0OiJldGNfZGF0ZXBpY2tlciI7czo2OiJhdXRob3IiO3M6
MDoiIjtzOjEwOiJhdXRob3JfdXJpIjtzOjA6IiI7czo3OiJ2ZXJzaW9uIjtzOjU6IjAuMi4y
IjtzOjExOiJkZXNjcmlwdGlvbiI7czowOiIiO3M6NDoiY29kZSI7czoxODM2OiJyZWdpc3Rl
cl9jYWxsYmFjaygnZXRjX2RhdGVwaWNrZXInLCAnYWRtaW5fc2lkZScsICdib2R5X2VuZCcp
Ow0KDQpmdW5jdG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nKS52YWwoa2V5KTsNCiAg
ICAgICAgICAgIH0NCiAgICAgICAgfQ0KICAgICkuY2hhbmdlKCk7DQp9DQoNCmV0Y0RhdGVw
aWNrZXIoKTsNCn0pOw0KSlM7DQplY2hvIHNjcmlwdF9qcygkc2NyaXB0KTsNCn0iO3M6NDoi
dHlwZSI7czoxOiIzIjtzOjU6Im9yZGVyIjtzOjE6IjUiO3M6NToiZmxhZ3MiO3M6MToiMCI7
czo0OiJoZWxwIjtzOjA6IiI7czozOiJtZDUiO3M6MzI6IjJkZjZiYjMxN2QxM2Y2ZTkzYzMy
ZTVlYmQ0ZGU5MDFiIjt9

Last edited by etc (2017-09-15 08:34:07)


etc_[ query | search | pagination | date | tree | cache ]

Offline

#5 2017-09-13 08:33:57

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,122
Website

Re: Expiration datepicker

etc wrote #306972:

You can try this plugin, it seems to work ok for me:

Seems to work fine in Safari and Firefox. Can’t select a date from the keyboard, but you knew that already.

Offline

#6 2017-09-13 10:01:47

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 2,755
Website

Re: Expiration datepicker

phiw13 wrote #306966:

The JQ-ui date picker widget was once tried in Core (Write panel) – quite a long time ago (pre 4.6, IIRC maybe philwareham remembers).

Yes Philippe is correct, I toyed with date-pickers for a while but the retooling necessary was beyond my scope and the accessibility was not great at the time. I do still have the way I’d want the UI to appear in my mockups (as a non-intrusive icon to the side of the date entry fields). And I keep the jQuery UI datepicker widget styling up to date just in case (although the jQuery UI team is doing a total rewrite of that widget at the moment to improve touch and accessibility support).

Maybe one day date and time HTML5 input fields will have universal browser support and we can just use that. Safari seems to be dragging it’s heels on that, Firefox support is nearly here, and IE won’t ever have it (though Edge does).

In the meantime I’d like to see the current (3) fields that form the date inputs to at least change format depending on language used – at the moment it’s hardcoded to the US format of YYYY MM DD when most of the world uses DD MM YYYY.

Offline

#7 2017-09-13 11:09:58

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,187
Website

Re: Expiration datepicker

The full proof way would be to have 3 pull-down menus, as 90s as the method might be:)


Yiannis
——————————
neme.org | hblack.net | LABS | NeMe @ github

Offline

#8 2017-09-13 12:24:28

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

Re: Expiration datepicker

philwareham wrote #306976:

(…) at the moment it’s hardcoded to the US format of YYYY MM DD when most of the world uses DD MM YYYY.

I always thought YYYY MM DD is ISO 8601, and for archiving it makes sense.

Offline

#9 2017-09-13 12:34:33

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 2,755
Website

Re: Expiration datepicker

GugUser wrote #306978:

I always thought YYYY MM DD is ISO 8601, and for archiving it makes sense.

Yes but people don’t generally write in ISO 8601, they write in their natural language.

Offline

#10 2017-09-13 13:16:55

etc
Developer
Registered: 2010-11-11
Posts: 2,248
Website

Re: Expiration datepicker

phiw13 wrote #306974:

Seems to work fine in Safari and Firefox. Can’t select a date from the keyboard, but you knew that already.

Plugin updated to enable the keyboard input, but still not perfect.


etc_[ query | search | pagination | date | tree | cache ]

Offline

Board footer

Powered by FluxBB