Comments (5)
I've been a bit reluctant to add dd/mm/yy as a valid time format since it's not a "valid" format, but .. ok, I'll add it to the next release. Thank you for the code sample.
from acf-field-date-time-picker.
I'm curious what is meant by 'dd/mm/yy ...[is] not a "valid" format'. Is this a coding issue or a convention issue? If conventional, dd/mm/yy is standard in Europe.
from acf-field-date-time-picker.
The format 'dd/mm/yy' is standard in the UK and this plugin didn't work when using that format. I'm not sure about the default format in other countries.
from acf-field-date-time-picker.
By "not valid" I mean that strtotime doesn't understand dd/mm/yy (see notes: "if the separator is a slash (/), then the American m/d/y is assumed").
If the requirements for running WordPress were PHP 5.3 I would have used DateTime::createFromFormat, but it's PHP 5.2.4 and hence I have to use strtotime .
from acf-field-date-time-picker.
Fixed, please test the latest version here at github
@BIOSTALL, I did this (to support d/m/y (i.e. a single 'd'), there are some countries using it:
function update_value( $value, $post_id, $field ) {
$field = array_merge($this->defaults, $field);
if ($value != '' && $field['save_as_timestamp'] == 'true') {
if (preg_match('/^dd?\//',$field['date_format'] )) { //if start with dd/ or d/ (not supported by strtotime())
$value = str_replace('/', '-', $value);
}
$value = strtotime( $value );
}
return $value;
}
from acf-field-date-time-picker.
Related Issues (20)
- Date only request HOT 1
- readonly Setting is Missing.
- After acf Update class acf_field_date_time_picker is declared more than once HOT 15
- Cannot save a time output that does not show a date HOT 1
- EOL ACF PRO 5.0 support (?) HOT 2
- Re-adding support for ACF PRO HOT 4
- Limit timespan
- Setting a default time using the time only option in ACF HOT 4
- "English (Canada)" WordPress Regional Setting Interpreted as Catala
- Php error (uncaught error calling undefined function) HOT 1
- UI time picker doesn't run? HOT 2
- Save and Get in ISO 8601 Format HOT 1
- Feature request: Bind the "Now" button to the site's timezone setting
- Is this maintained?
- Can't include in plugin HOT 3
- Can't order posts correctly, because saving as timestamp doesn't work!
- Year and month reversed using timestamps HOT 1
- Saving as timestamp doesn't work HOT 2
- Time Picker doesn't show on Front End HOT 1
- How i call the picker in other admin inputs? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acf-field-date-time-picker.