Skip to content
This repository has been archived by the owner on Mar 2, 2018. It is now read-only.

Need MM/DD/YYYY hh:mm a format time but ... #209

Open
egnashko opened this issue Jul 17, 2017 · 2 comments
Open

Need MM/DD/YYYY hh:mm a format time but ... #209

egnashko opened this issue Jul 17, 2017 · 2 comments

Comments

@egnashko
Copy link

Need MM/DD/YYYY hh:mm a format time but ...

Hi! I need "MM/DD/YYYY hh:mm am/pm" format time but "date-format" doesn't work it doesn't give any data when event happens, i also tried to make own format but can't understand how to make it, can u help me with it?

Can u give an example with this function:

"// Override Date object formatter
NguiDatetime.formatDate = (date: Date) : string => {
    ..... my own function that returns a string ....
};"

Or if its possible to give me a code in property above, which will return me the needed format, please help.
Thank you for attention.

@allenhwkim
Copy link
Contributor

allenhwkim commented Jul 17, 2017

Please include MomentJS,

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment-with-locales.min.js"></script>

and the format should be date-format="MM/DD/YYYY hh:mm" according to https://momentjs.com/docs/#/parsing/string-format/

@egnashko
Copy link
Author

egnashko commented Jul 18, 2017

Thank you, it works. But also have one question. When i am choosing time i still have 24 hours, not 12 am and 12 pm, can i change it somewhere?
The [show-am-pm]="true" not working, returns error Template parse errors: Can't bind to 'show-am-pm' since it isn't a known property of 'input'.

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

No branches or pull requests

2 participants