How To Add Moment.Js Link As Reference In SharePoint 2013

Adding Moment.js as a reference in SharePoint 2013 allows you to leverage its powerful date and time manipulation functionalities within your SharePoint code.

To add Moment.js as a reference in SharePoint 2013, you can follow these steps:

  1. Include the Moment.js library in your SharePoint site. This can be done by adding the Moment.js CDN link in your HTML code or by uploading the Moment.js file to a document library in SharePoint.
  2. Once the library is included, you can start using Moment.js in your SharePoint code. For example, if you want to retrieve the “from now” value of a date field using the SharePoint REST API, you can use the Moment.js library to format the date.
  3. In your SharePoint REST API code, you can use the moment() function to create a Moment object from the date values retrieved from SharePoint. For example, you can use the moment(createdDate3).fromNow() function to get the “from now” value of the createdDate3 variable.
  4. Make sure to include the necessary dependencies for Moment.js, such as the jQuery dateFormat library if needed. You can include these dependencies by adding the corresponding script tags in your HTML code.

By following these steps, you should be able to add Moment.js as a reference in SharePoint 2013 and use its functionalities in your SharePoint code.

Is Adding Moment.Js Link as Reference in SharePoint 2013 Necessary to Get SharePoint Site ID?

Adding the Moment.js link as a reference in SharePoint 2013 is not necessary to get SharePoint Site ID.

Can I Use Moment.js in SharePoint 2013 for My OneNote Upload?

Yes, you can use Moment.js in SharePoint 2013 for uploading OneNote to SharePoint. Moment.js is a popular JavaScript library that helps with managing and manipulating dates and times. By integrating Moment.js into your SharePoint environment, you can enhance the functionality of your OneNote upload feature. With Moment.js, you can easily format and display timestamps, calculate durations, and perform various date and time operations seamlessly within your SharePoint platform.

Steps to Add Moment.Js Link as Reference in SharePoint 2013

To add Moment.js as a reference in SharePoint 2013, follow these steps to ensure seamless integration and utilization in your SharePoint projects:

1. Include the Moment.js library in your SharePoint site. You can do this by either adding the Moment.js CDN link in your HTML code or by uploading the Moment.js file to a document library in SharePoint. This step allows SharePoint to recognize and use Moment.js functionalities.

2. Once the library is included, you can start using Moment.js in your SharePoint code. For example, if you want to retrieve the “from now” value of a date field using the SharePoint REST API, you can leverage the Moment.js library to format the date accordingly. This enhances the overall functionality and user experience of your SharePoint site.

3. In your SharePoint REST API code, make use of the moment() function to create a Moment object from the date values retrieved from SharePoint. For instance, you can utilize the moment(createdDate3).fromNow() function to obtain the “from now” value of the createdDate3 variable. This allows you to manipulate and display date values in a more user-friendly format.

4. Ensure that you include the necessary dependencies for Moment.js, such as the jQuery dateFormat library if required. You can include these dependencies by adding the corresponding script tags in your HTML code. This step guarantees that Moment.js functions correctly and seamlessly interacts with other libraries or frameworks you may be using in your SharePoint environment.

By following these steps, you will be able to successfully add Moment.js as a reference in SharePoint 2013 and leverage its powerful functionalities in your SharePoint projects. Enhance your SharePoint site with Moment.js and provide your users with an enhanced and intuitive experience.

Meet the Author

Abdul Rahim has been working in Information Technology for over two decades. Learn how Abdul got his start as a Tech Blogger , and why he decided to start this Software blog. If you want to send Abdul a quick message, then visit his contact page here.