Guest User

Untitled

a guest
Oct 17th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. // If you have a JavaScript project that currently uses
  2. // the plain Date object of JS and you want to move completely
  3. // to Moment.js (what you should really do!)
  4. // you will have to use some different functions.
  5.  
  6. // The below list shows the Date object's functions on the left
  7. // and their Moment.js equivalent on the right side.
  8. // This is useful for a search/replace task in your IDE.
  9.  
  10. .getTime() -> .valueOf()
  11.  
  12. .getFullYear() -> .year()
  13.  
  14. .getYear() -> .year()
  15.  
  16. .getMonth() -> .month()
  17.  
  18. .getDate() -> .date()
  19.  
  20. .getHours() -> .hours()
  21.  
  22. .getMinutes() -> .minutes()
  23.  
  24.  
  25.  
  26. .setDate( -> .date(
  27.  
  28. .setFullYear( -> .year(
  29.  
  30. .setHours( -> .hours(
  31.  
  32. .setMonth( -> .months(
  33.  
  34. .setSeconds( -> .seconds(
  35.  
  36. .setMilliseconds( -> .milliseconds(
  37.  
  38. .setMinutes( -> .minutes(
  39.  
  40. .setTime( -> .unix(
Add Comment
Please, Sign In to add comment