Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date option default expects timestamp, docs state Y-m-d formatted string #408

Closed
TreyOverton opened this issue Feb 21, 2018 · 3 comments
Closed

Comments

@TreyOverton
Copy link

This works:

$tab->createOption([
    'name' => 'Report Date',
    'id' => 'hidden-report-date',
    'type' => 'date',
    'default' => time()
]);

This does not:

$tab->createOption([
    'name' => 'Report Date',
    'id' => 'hidden-report-date',
    'type' => 'date',
    'default' => date('Y-m-d')
]);

Documentation example is 'default' => '2010-12-20',, found here: http://www.titanframework.net/docs/date/

Using the documented technique for a default always produces a date of 1970-01-01 (timestamp 0).

@mrjk990
Copy link

mrjk990 commented Feb 22, 2018

@AaronOverton
you should use date function like this
date('Y-m-d', time())
Reference: http://php.net/manual/en/function.date.php

$tab->createOption([
    'name' => 'Report Date',
    'id' => 'hidden-report-date',
    'type' => 'date',
    'default' => date('Y-m-d', time())
]);

@juyal-ahmed
Copy link
Contributor

This pull request has the support for that date format default input with a couple of other update.
#410

@bfintal
Copy link
Contributor

bfintal commented Jul 4, 2018

@tojibon Can you resubmit the PR for the date issue only?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants