I've noticed that SharePoint 2013 uses past tense time periods for a lot of it's date formatting. eg
- A few seconds ago
- Yesterday at 3:00pm
- 5 days ago etc.
Is there a JavaScript method available that takes a date and returns that type of format?
|
I've noticed that SharePoint 2013 uses past tense time periods for a lot of it's date formatting. eg
Is there a JavaScript method available that takes a date and returns that type of format? |
|||
|
|
|
When I worked with ClientContext I got dates in form of
|
|||
|
|
I haven't seen this javascript code in sharepoint javascript API. I would like to recommend moment.js a lightweight javascript library for date and time handling in javascript which can show relative time as well |
|||
|
|
|
Not in 2010 and haven't found one in 2013 (yet). The method SP uses to generate the formatting is SPUtility.TimeDeltaAsString(). I've Reflector in that method in 2010 and it seems to be fairly straight forward if I was to do a JavaScript implementation. Maybe the same approach would work in 2013? |
|||
|
|