-
Notifications
You must be signed in to change notification settings - Fork 56
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 filter #11
Date filter #11
Conversation
Did you check the Closure Library for their date formatting support? I'd like to limit the code that we have to maintain ourselves wherever possible. |
Checked it just now, and it seems that it implements only native js Date object methods, that still doesn't help to format date inside the template |
Is http://momentjs.com/ is not an option? |
Depends on how compatible it is with PHP, but it looks pretty big (half the size of the entire library). So, maybe as a separate file that can be included on demand only. The reason why I haven't merged this yet is that there are some tests for which this patch is failing, and that it is depending on the browser for parsing (inconsistent). If someone wants to take a stab, please select the date-related tests from https://github.com/fabpot/Twig/tree/master/test/Twig/Tests/Fixtures, and add their names in this file: https://github.com/schmittjoh/twig.js/blob/master/bin/generate_test_templates.php#L45 |
something new ? |
I associate myself! |
The I'm not 100% opposed to the idea though. If anybody out there has the time for this task, I'd welcome a high quality pull request with open arms. It'd be a lot of code though, and we'd need an even larger quantity of automated tests for it. It's a big job. Let's close this issue for now. |
@hnrysmth Would this be an option? http://phpjs.org/functions/date/ |
Adds date filter to twig.js. It is not fully implemented and doesn't support all php date formatting symbols, but I still think it may be useful to have at least some of the formatting possibilities.
I'm also not sure about twig.js and twig.dev.js - it was generated be compile.php script and it seems to rewrite all the files, not just filter connected parts.