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

Add datetime picker and use ISO8601 format #38

Merged
merged 3 commits into from
Oct 2, 2015
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ to keep the **UI** and the **Backend** focused on what they can best.
- User input is validated with [validate.js](http://rickharrison.github.io/validate.js/)
- Commands are sent to the server using [jQuery.ajax](https://jquery.com/)
- Server messages are presented by [notify.js](http://notifyjs.com/)
- Datetime objects are handled with [moment.js](http://momentjs.com/)
- Datetime picker support provided by [bootstrap-datetimepicker](http://eonasdan.github.io/bootstrap-datetimepicker/)
- JavaScript UUID generator taken from [https://gist.github.com/duzun/d1bfb5406a362e06eccd](https://gist.github.com/duzun/d1bfb5406a362e06eccd)
- Little helpers: [lodash.js](https://lodash.com/) and [undersocre.string.js](http://gabceb.github.io/underscore.string.site/)

Expand Down
2 changes: 2 additions & 0 deletions config/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
//riot tags
'riot::user-form' => 'view/riot/user-form.phtml',
'riot::user-todo-form' => 'view/riot/user-todo-form.phtml',
'riot::user-todo-list' => 'view/riot/user-todo-list.phtml',
'riot::user-todo' => 'view/riot/user-todo.phtml',
],
'plugins' => [
'riotTag' => \Prooph\ProophessorDo\App\View\Helper\RiotTag::class,
Expand Down
2 changes: 1 addition & 1 deletion migrations/Version20150924204612.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Version20150924204612 extends AbstractMigration
public function up(Schema $schema)
{
$todo = $schema->getTable(Table::TODO);
$todo->addColumn('deadline', 'datetime', ['default' => null, 'notnull' => false]);
$todo->addColumn('deadline', 'string', ['default' => null, 'notnull' => false, 'length' => 30]);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codeliner Why do you prefer \Doctrine\DBAL\Types::STRING over \Doctrine\DBAL\Types::DATETIMETZ? Good databases like Postgres support storing TZ in a datetime field. Storing the value as a string will prevent you from selecting TODOs which deadline is today on a database level.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question!
Basically because of this limitation

The purpose of read tables is to provide information in a query-friendly way. ISO8601 is a common standard and I would like to store datetime without the need to map it again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the reason why I named Postgres. My idea was to rather save the dates in UTC and handle the conversion on application side, but you are right, DateTime handles TZs really well and if we don't need the datetime type in the DB, you might as well save it as string in ISO8601 format.

public function down(Schema $schema)
Expand Down
5 changes: 5 additions & 0 deletions public/css/bootstrap.datetimepicker.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions public/js/bootstrap-datetimepicker.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions public/js/moment.min.js

Large diffs are not rendered by default.

Loading