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 format string strips escape characters? #163

Closed
cxj opened this issue Jun 12, 2017 · 7 comments
Closed

Date format string strips escape characters? #163

cxj opened this issue Jun 12, 2017 · 7 comments

Comments

@cxj
Copy link
Contributor

cxj commented Jun 12, 2017

I'm trying to format my date-time string using the localization date string, as described here in the wiki. But the TSS processing seems to strip the backslashes out before the PHP date() or equivalent command is called to format the string. Here's my TSS:

.created {
    content: data(output.user_data.create_time);
    format: date "jS M Y \a\t h:s a";
}

Expected output:
30th May 2017 at 10:52 am
Actual output:
30th May 2017 am31 10:52 am

@cxj
Copy link
Contributor Author

cxj commented Jun 12, 2017

Simple test program:

$xml = '<div class="created">--</div>';

$tss = '.created {
        content: data(create_time);
        format: date "jS M Y \a\t h:s a";
    }';

$data['create_time'] = '2017-06-08 22:30:51.509626';
$tpl = new Transphporm\Builder($xml, $tss);
echo $tpl->output($data)->body;

@garrettw
Copy link
Contributor

Have you tried doubling the backslashes? I don't know for sure if it would work, but it's worth a try.

@cxj
Copy link
Contributor Author

cxj commented Jun 13, 2017

Yes, tried that, with same result.

@solleer
Copy link
Collaborator

solleer commented Jun 13, 2017

Try using 4 if you are using a PHP string

@solleer
Copy link
Collaborator

solleer commented Jun 13, 2017

Use 2 if it's from a file

@cxj
Copy link
Contributor Author

cxj commented Jun 13, 2017

My actual use case is all from XML and TSS files. Using 2 fails from files. Using 4 fails from a PHP string.

@solleer
Copy link
Collaborator

solleer commented Jun 18, 2017

This issue should be fixed now

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

No branches or pull requests

3 participants