Javascript nhận chữ viết tắt múi giờ

Khoảng khăc. js đã được sử dụng thành công trong hàng triệu dự án và chúng tôi rất vui vì đã góp phần làm cho ngày và giờ tốt hơn trên web. Tính đến tháng 9 năm 2020, Moment nhận được hơn 12 triệu lượt tải xuống mỗi tuần. Tuy nhiên, Moment được xây dựng cho kỷ nguyên trước của hệ sinh thái JavaScript. Web hiện đại ngày nay trông khác nhiều. Moment đã phát triển phần nào trong những năm qua, nhưng về cơ bản nó vẫn giữ nguyên thiết kế như khi nó được tạo ra vào năm 2011. Dựa vào số lượng dự án phụ thuộc vào nó, chúng tôi chọn ưu tiên tính ổn định hơn các tính năng mới

Ví dụ, xem xét rằng các đối tượng Khoảnh khắc có thể thay đổi. Đây là một nguồn khiếu nại phổ biến về Moment. Chúng tôi giải quyết vấn đề này trong hướng dẫn sử dụng nhưng nó vẫn gây ngạc nhiên cho hầu hết người dùng mới. Thay đổi Khoảnh khắc thành bất biến sẽ là một thay đổi đột phá đối với mọi dự án sử dụng nó. Tạo một "Moment v3" không thay đổi sẽ là một công việc to lớn và sẽ biến Moment thành một thư viện hoàn toàn khác. Since this has already been accomplished in other libraries, we feel that it is more important to retain the mutable API

Một lập luận phổ biến khác chống lại việc sử dụng Moment trong các ứng dụng hiện đại là kích thước của nó. Moment doesn't work well with modern "tree shaking" algorithms, so it tends to increase the size of web application bundles. If one needs internationalization or time zone support, Moment can get quite large. Modern web browsers [and Node. js] expose internationalization and time zone support via the

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
68 object, codified as ECMA-402. Libraries like Luxon [and others] take advantage of this, reducing or removing the need to ship your own data files

Gần đây, Chrome Dev Tools đã bắt đầu hiển thị các đề xuất để thay thế Khoảnh khắc cho riêng kích thước. Chúng tôi thường ủng hộ động thái này

Bạn cũng có thể muốn đọc

  • Có lẽ bạn không cần thời gian. js nữa
  • Bạn không [có thể không] cần Khoảnh khắc. js
  • Tại sao bạn không nên sử dụng Moment. js
  • 4 lựa chọn thay thế cho thời điểm. js để quốc tế hóa ngày tháng

Nhóm Moment đã thảo luận về những vấn đề này rất lâu. Chúng tôi nhận thấy rằng nhiều dự án hiện tại có thể tiếp tục sử dụng Moment, nhưng chúng tôi không muốn Moment được sử dụng trong các dự án mới trong tương lai. Thay vào đó, chúng tôi muốn giới thiệu các giải pháp thay thế là những lựa chọn tuyệt vời để sử dụng trong các ứng dụng hiện đại ngày nay. Chúng tôi cũng muốn quảng cáo bổ sung

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
69 cho ngôn ngữ JavaScript đang tìm kiếm phản hồi và cộng tác viên

Hiện tại, chúng tôi thường coi Khoảnh khắc là một dự án kế thừa ở chế độ bảo trì. Nó không chết, nhưng nó thực sự được thực hiện

Trong thực tế, điều này có nghĩa là

  • Chúng tôi sẽ không thêm các tính năng hoặc khả năng mới
  • Chúng tôi sẽ không thay đổi API của Moment thành bất biến
  • Chúng tôi sẽ không giải quyết các vấn đề về rung cây hoặc kích thước bó
  • Chúng tôi sẽ không thực hiện bất kỳ thay đổi lớn nào [không có phiên bản 3]
  • Chúng tôi có thể chọn không sửa lỗi hoặc hành vi kỳ quặc, đặc biệt nếu chúng là những vấn đề đã biết từ lâu

Liên quan cụ thể đến các tệp ngôn ngữ quốc tế hóa của Moment

  • Chúng tôi có thể chọn không chấp nhận các sửa đổi đối với chuỗi bản địa hóa hoặc định dạng ngày được bản địa hóa, đặc biệt nếu chúng đã được lập luận thành công cho biểu mẫu hiện tại của chúng
  • Bạn phải đưa ra một lập luận thuyết phục mới cho những thay đổi ngôn ngữ với bằng chứng quan trọng, phi giai thoại để hỗ trợ cho quan điểm của bạn
  • Nếu chuỗi hoặc định dạng bạn đang yêu cầu thay đổi được phản ánh trong CLDR, thì bạn phải gửi thay đổi ở đó trước và được chấp nhận

Tuy nhiên, vì chúng tôi hiểu rằng Khoảnh khắc đã được thiết lập tốt trong hàng triệu dự án hiện có

  • Chúng tôi sẽ giải quyết các vấn đề quan trọng về bảo mật khi chúng phát sinh
  • Chúng tôi sẽ phát hành các bản cập nhật dữ liệu cho Múi giờ theo thời điểm sau khi phát hành cơ sở dữ liệu múi giờ IANA

Lý do để tiếp tục sử dụng Moment

Trong hầu hết các trường hợp, bạn không nên chọn Moment cho các dự án mới. Tuy nhiên, có một số lý do có thể khiến bạn muốn tiếp tục sử dụng nó

hỗ trợ trình duyệt

Khoảnh khắc hoạt động tốt trên Internet Explorer 8 trở lên. Ngược lại, Luxon chỉ hoạt động trên IE 10 trở lên và yêu cầu một polyfill để làm như vậy. Bạn có thể đọc thêm trong tài liệu của Luxon

Các thư viện khác cũng gặp sự cố với Safari, đặc biệt là trên thiết bị di động. Nếu bạn có yêu cầu mạnh mẽ để hỗ trợ các trình duyệt cũ hơn, thì bạn có thể muốn gắn bó với Moment lâu hơn một chút

Tuy nhiên, ngày. js báo cáo khả năng tương thích với IE8 trở lên, do đó bạn vẫn có thể muốn xem xét giải pháp thay thế đó

Sự phụ thuộc của các thư viện khác

Một số thư viện khác, đặc biệt là bộ chọn ngày và thư viện vẽ đồ thị, lấy Khoảnh khắc làm phụ thuộc. Nếu bạn đang sử dụng một thành phần như vậy và không thể tìm thấy một thành phần thay thế, thì bạn đã bao gồm Khoảnh khắc trong dự án của mình. Do đó, có thể hợp lý khi tiếp tục sử dụng Khoảnh khắc trong suốt dự án của bạn thay vì bao gồm một thư viện ngày và giờ khác

quen thuộc

Nếu bạn là người dùng Moment lâu năm, bạn có thể đã hiểu rõ về API và các hạn chế của nó. Nếu đúng như vậy và các vấn đề nêu trên không phải là mối bận tâm của bạn, thì bạn chắc chắn có thể tiếp tục sử dụng nó

khuyến nghị

chỉnh sửa

Có một số tùy chọn tuyệt vời để xem xét sử dụng thay vì Khoảnh khắc

Khi lựa chọn, hãy xem xét rằng

  • Một số thư viện được chia thành các mô-đun, plugin hoặc thư viện đồng hành
  • Một số thư viện sử dụng API ECMAScript
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    68 cho ngôn ngữ, múi giờ hoặc cả hai
  • Một số thư viện vẫn cung cấp các tệp miền địa phương và múi giờ của riêng họ như Moment và Moment-Timezone do

Dưới đây là các lựa chọn thay thế chúng tôi đề xuất

Luxon

Luxon có thể được coi là sự phát triển của Moment. Nó được tác giả bởi Isaac Cambron, một cộng tác viên lâu năm của Moment. Vui lòng đọc Tại sao Luxon tồn tại?

  • địa phương.
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    68 được cung cấp
  • Múi giờ.
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    68 được cung cấp

Ngày. js

Ngày. js được thiết kế để thay thế tối giản cho Moment. js, sử dụng API tương tự. Đây không phải là sự thay thế tùy chọn, nhưng nếu bạn đã quen sử dụng API của Moment và muốn di chuyển nhanh chóng, hãy cân nhắc sử dụng Day. js

  • địa phương. Các tệp dữ liệu tùy chỉnh có thể được nhập riêng lẻ
  • Múi giờ.
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    68 được cung cấp, thông qua plugin

ngày-fns

Date-fns cung cấp một loạt các chức năng để thao tác với các đối tượng JavaScript

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
74. Để biết thêm chi tiết, hãy cuộn đến "Tại sao lại là date-fns?"

  • địa phương. Các tệp dữ liệu tùy chỉnh có thể được nhập riêng lẻ
  • Múi giờ.
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    68 được cung cấp, thông qua một thư viện đồng hành riêng biệt

js-Joda

js-Joda là một cổng JavaScript của Three-Ten Backport của Java, là cơ sở để triển khai JSR-310 của gói Java SE 8

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
76. Nếu bạn đã quen thuộc với
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
76, Joda-Time hoặc Noda Time, bạn sẽ thấy js-Joda có thể so sánh được

  • Locales. Custom data files via add-on module
  • Time Zones. Custom data files via add-on module

No Library

JavaScript has always had a

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
74 object, defined ECMAScript [ECMA-262] specification here

When using

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
74 objects, be aware of the following

  • The

    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    74 object internally represents a Unix timestamp with millisecond precision. It offers functions that will convert to and from the system's local time zone, but it is always UTC internally. Unlike a
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    81 object, it can not be set to use another time zone; It has no concept of "mode"

  • Using

    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    82, or
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    83 has been problematic and implemented inconsistently in the past. The current specification defines parsing a variation of ISO 8601 strings, where date-only forms [like
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    84] are parsed as UTC, instead of local time as they would be by ISO 8601. Even then, not all modern implementations have implemented this specification correctly [e. g. , Safari]. Other types of strings may work, but parsing them is implementation specific and can vary significantly - especially with older browsers. Depending on the implementation, and the components provided in the string, you may be surprised with the result. For these reasons, we agree with MDN's statement that parsing strings with the
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    74 object is strongly discouraged

Modern JavaScript environments will also implement the by ECMA-402 specification, which provides the

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
68 object, and defines behavioral options of the
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
74 object's
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
88,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
89, and
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
90 functions

When using the

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
68 object, be aware of the following

  • Not every environment will implement the full specification. In particular, Node. js environments require internationalization support provided by ICU. See the Node. js documentation for further details
  • The ECMAScript Intl compatibility table [by kangax] can be useful in determining which features are supported and which are not
  • Most newer environments provide IANA time zone support via the
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    92 option in the
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    93 constructor [and in
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    94,
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    95, and
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    96]. This option can be used to take the internal UTC-based timestamp of a
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    74 object and get a string that has been converted to a named time zone. However, it can not be used to convert a
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    74 object to a different time zone

If the

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
74 and
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
68 objects meet your needs and you fully understand their limitations, then you might consider using them directly

The Future

chỉnh sửa

Temporal - Better dates and times in the JavaScript language

One day soon, we hope there won't be a strong need for date and time libraries in JavaScript at all. Instead, we will be able to use capabilities of the JavaScript language itself. Though some capabilities are here today with

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
74 and
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
68, we know from experience and data that there is significant room for improvement

The effort to make better date and time APIs in the JavaScript language is being done via The ECMA TC39 Temporal Proposal. Nó hiện đang ở Giai đoạn 3 của quy trình TC39

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
69 will be a new global object that acts as a top-level namespace [like
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
604]. It exposes many separate types of objects including
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
605,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
606,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
607,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
608,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
609,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
610 and several others. The Temporal Cookbook shows many "recipes" with examples of how these objects can be used in different scenarios

You can try out Temporal today, via a non-production polyfill. Please give it a try, but don't use it in production [yet]

Please provide feedback, and consider contributing to this effort - especially if you have experience using Moment or other date and time libraries

Require. js

chỉnh sửa

We strongly recommend reading this if you plan to use moment with Require. js. Also upgrade to 2. 14. 0 or above for best experience

As a start, you might have acquired moment through bower or node_modules or anything else that places moment. js together with a locales directory in a base folder. Sau đó, bạn nên sử dụng công cụ như Adapt-pkg-main hoặc thủ công -- sử dụng cấu hình gói

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
3

Với thiết lập ở trên, bạn có thể yêu cầu lõi có ngôn ngữ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
611 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
612 với
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
613

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];

Đối với các trường hợp sử dụng phức tạp hơn, vui lòng đọc phần giải thích tuyệt vời của @jrburke

Khoảnh khắc vẫn sẽ tạo một

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
611 toàn cầu, hữu ích cho các plugin và mã của bên thứ ba khác. Nếu bạn muốn xóa toàn cầu đó, hãy sử dụng tùy chọn
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
615 trên cấu hình mô-đun

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
6

Nếu bạn không chỉ định

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
615 thì thời điểm được xuất trên toàn cầu sẽ in cảnh báo không dùng nữa. Từ bản phát hành chính tiếp theo, bạn sẽ phải tự xuất nó nếu muốn hành vi đó

Đối với phiên bản 2. 5. x, trong trường hợp bạn sử dụng các plugin khác dựa trên Moment nhưng không tương thích với AMD, bạn có thể cần thêm

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
617 vào r của mình. cấu hình js

Ghi chú. Để cho phép khoảnh khắc. js sẽ được tải trong môi trường requestjs, thời điểm được tạo dưới dạng mô-đun có tên. Do đó, thời điểm phải được tải chính xác như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
618, sử dụng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
619 để xác định thư mục. Yêu cầu thời điểm có đường dẫn như
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
620 sẽ trả về
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
621

Ghi chú. Từ phiên bản 2. 9. 0 tự xuất dưới dạng một mô-đun ẩn danh, vì vậy nếu bạn chỉ sử dụng lõi [không có ngôn ngữ / plugin], thì bạn không cần cấu hình nếu đặt nó ở một vị trí không chuẩn

Chuỗi 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
7

Khi tạo một khoảnh khắc từ một chuỗi, trước tiên, chúng tôi kiểm tra xem chuỗi đó có khớp với các định dạng ISO 8601 đã biết hay không, sau đó chúng tôi kiểm tra xem chuỗi đó có khớp với định dạng ngày giờ RFC 2822 hay không trước khi chuyển xuống

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
622 nếu không tìm thấy định dạng đã biết

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
9

Cảnh báo. Hỗ trợ trình duyệt để phân tích chuỗi không nhất quán. Do không có thông số kỹ thuật về định dạng nào sẽ được hỗ trợ nên những gì hoạt động trong một số trình duyệt sẽ không hoạt động trong các trình duyệt khác

Để có kết quả nhất quán khi phân tích cú pháp bất kỳ thứ gì ngoài chuỗi ISO 8601, bạn nên sử dụng Chuỗi + Định dạng

Chuỗi ISO 8601 được hỗ trợ

Một chuỗi ISO 8601 yêu cầu một phần ngày

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
0

Phần thời gian cũng có thể được bao gồm, được phân tách với phần ngày bằng dấu cách hoặc chữ T viết hoa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
1

Bất kỳ phần ngày nào cũng có thể có phần thời gian

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
2

Nếu bao gồm một phần thời gian, thì phần bù từ UTC cũng có thể được bao gồm như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
623,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
624,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
625 hoặc
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
626

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
7

Ghi chú. Hỗ trợ cho các định dạng tuần và thứ tự đã được thêm vào trong phiên bản 2. 3. 0

Nếu một chuỗi không khớp với bất kỳ định dạng nào ở trên và không thể phân tích cú pháp bằng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
82, thì
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
628 sẽ trả về false

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
0

Định dạng ngày giờ RFC 2822

Trước khi phân tích cú pháp ngày giờ RFC 2822, chuỗi được xóa để xóa mọi nhận xét và/hoặc ký tự dòng mới. Các ký tự bổ sung có định dạng hợp pháp nhưng không bổ sung gì để tạo một phiên bản thời điểm hợp lệ

Sau khi làm sạch, chuỗi được xác thực trong các phần được phân tách bằng dấu cách sau đây, tất cả đều sử dụng ngôn ngữ tiếng Anh

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
0
  1. Ngày trong tuần bằng ba chữ cái, theo sau là dấu phẩy tùy chọn. [không bắt buộc]
  2. Ngày trong tháng [1 hoặc 2 chữ số], theo sau là tháng gồm ba chữ cái và năm gồm 2 hoặc 4 chữ số
  3. Hai chữ số giờ và phút cách nhau bởi dấu hai chấm [. ], theo sau tùy ý là dấu hai chấm khác và giây ở dạng 2 chữ số
  4. Múi giờ hoặc độ lệch ở một trong các định dạng sau
  5. UT. +0000
  6. giờ GMT. +0000
  7. EST. CST. MST. PST. EDT. CĐT. MDT. PDT. Múi giờ Hoa Kỳ*
  8. Một - tôi. K-Z. Múi giờ quân sự*
  9. Thời gian bù +/-9999

[*]Xem phần 4. 3 của đặc điểm kỹ thuật để biết chi tiết

Trình phân tích cú pháp cũng xác nhận rằng ngày trong tuần [khi được đưa vào] nhất quán với ngày

Chuỗi + Định dạng 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
1

Nếu bạn biết định dạng của chuỗi đầu vào, bạn có thể sử dụng định dạng đó để phân tích một khoảnh khắc

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
2

Theo mặc định, trình phân tích cú pháp bỏ qua các ký tự không phải chữ và số, vì vậy cả hai ký tự sau đây sẽ trả về cùng một thứ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
3

Bạn có thể nhận được kết quả không mong muốn khi phân tích cả ngày và giờ. Ví dụ dưới đây có thể không phân tích cú pháp như bạn mong đợi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
4

Bạn có thể sử dụng chế độ nghiêm ngặt, chế độ này sẽ xác định lỗi phân tích cú pháp và đặt đối tượng Khoảnh khắc là không hợp lệ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
5

Mã thông báo phân tích cú pháp tương tự như mã thông báo định dạng được sử dụng trong

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
629

Mã thông báo năm, tháng và ngày

Mã thông báo phân biệt chữ hoa chữ thường

Đầu vàoVí dụMô tả____3630
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
6314 hoặc năm có 2 chữ số. Ghi chú. Chỉ có 4 chữ số có thể được phân tích cú pháp trên chế độ
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
632
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
633
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
6342 chữ số năm
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
635
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
636Năm với bất kỳ số chữ số và ký hiệu nào
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
637
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
638Quý của năm. Đặt tháng thành tháng đầu tiên trong quý.
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
639
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
640Số tháng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
641
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
642Tên tháng theo ngôn ngữ được đặt bởi
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
643
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
644
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
645Ngày trong tháng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
646
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
647Ngày trong tháng với thứ tự
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
648
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
649Ngày trong năm
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
650
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
651Dấu thời gian Unix
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
652
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
653Dấu thời gian ms Unix

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
630 từ phiên bản 2. 10. 5 supports 2 digit years, and converts them to a year near 2000 [same as
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
633]

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
635 was added in 2. 11. 1. It will match any number, signed or unsigned. It is useful for years that are not 4 digits or are before the common era. It can be used for any year

Week year, week, and weekday tokens

For these, the lowercase tokens use the locale aware week start days, and the uppercase tokens use the ISO week date start days

Mã thông báo phân biệt chữ hoa chữ thường

InputExampleDescription
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
657
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
631Locale 4 digit week year
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
659
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
634Locale 2 digit week year
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
661
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
662Locale week of year
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
663
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
664Locale day of week
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
665
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
666Day name in locale set by
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
643
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
668
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
631ISO 4 digit week year
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
670
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
634ISO 2 digit week year
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
672
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
662ISO week of year
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
674
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
675ISO day of week

Locale aware formats

Locale aware date and time formats are also available using

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
676. They were added in version 2. 2. 1, except
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
677 which was added 2. 8. 4

Mã thông báo phân biệt chữ hoa chữ thường

Đầu vàoVí dụMô tả
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
678
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
679Ngày [ở định dạng cục bộ]
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
680
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
681Tên tháng, ngày trong tháng, năm
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
682
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
683Tên tháng, ngày trong tháng, năm, thời gian
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
684
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
685Ngày trong tuần, tên tháng, ngày trong tháng, năm, thời gian
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
686
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
687Thời gian [không có giây]
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
677
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
689Thời gian [có giây]

Hour, minute, second, millisecond, and offset tokens

Mã thông báo phân biệt chữ hoa chữ thường

InputExampleDescription
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
690
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
691Hours [24 hour time]
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
692
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
640Hours [12 hour time used with
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
694. ]
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
695
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
696Hours [24 hour time from 1 to 24]
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
694
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
698Post or ante meridiem [Note the one character
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
699 are also considered valid]
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
700
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
701Minutes
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
702
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
701Seconds
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
704
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
705Fractional seconds
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
706
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
707Offset from UTC as
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
623,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
624, or
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
626

From version 2. 10. 5. fractional second tokens length 4 up to 9 can parse any number of digits, but will only consider the top 3 [milliseconds]. Use if you have the time printed with many fractional digits and want to consume the input

Note that the number of

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
711 characters provided is only relevant when parsing in strict mode. In standard mode,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
711,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
713,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
714,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
715 are all equivalent, and interpreted as fractions of a second. For example,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
716 is always 120 milliseconds, passing
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
713 will not cause it to be interpreted as 12 milliseconds

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
706 were added in version 1. 2. 0

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
719 đã được thêm vào trong phiên bản 1. 6. 0

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
650 đã được thêm vào trong phiên bản 2. 0. 0

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
721 đã được thêm vào trong phiên bản 2. 10. 5

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
695 đã được thêm vào trong phiên bản 2. 13. 0

Trừ khi bạn chỉ định chênh lệch múi giờ, việc phân tích cú pháp một chuỗi sẽ tạo ra một ngày theo múi giờ hiện tại

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
6

Mã thông báo liên quan đến Năm kỷ nguyên

Mã thông báo phân biệt chữ hoa chữ thường

Đầu vàoVí dụMô tả. yyyy
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
723Yearsyo
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
724Năm thứ tựN
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
725Tên thời đại AbbrNN
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
725Tên thời đại AbbrNNN
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
725Tên thời đại AbbrNNNN
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
728Tên thời đại đầy đủNNNNNN
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
725Tên thời đại hẹp

Hỗ trợ kỷ nguyên đã được thêm vào trong 2. 25. 0. Mã thông báo/API vẫn đang thay đổi

Ghi chú và gotchas

Nếu thời điểm kết quả từ đầu vào được phân tích cú pháp không tồn tại,

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
628 sẽ trả về false

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
7

Kể từ phiên bản 2. 0. 0, khóa ngôn ngữ có thể được chuyển làm tham số thứ ba cho

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
731 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
732

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
8

Trình phân tích cú pháp của Moment rất dễ tha thứ và điều này có thể dẫn đến hành vi không mong muốn/không mong muốn

Ví dụ, hành vi sau đây có thể được quan sát

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
9

Trước 2. 13. 0 trình phân tích cú pháp thể hiện hành vi sau. This has been corrected

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
60

Kể từ phiên bản 2. 3. 0, bạn có thể chỉ định một boolean cho đối số cuối cùng để khiến Moment sử dụng phân tích cú pháp nghiêm ngặt. Phân tích cú pháp nghiêm ngặt yêu cầu định dạng và đầu vào khớp chính xác, bao gồm cả dấu phân cách

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
61

Bạn có thể sử dụng cả ngôn ngữ và độ nghiêm ngặt

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
62

Strict parsing is frequently the best parsing option. Để biết thêm thông tin về cách chọn phân tích cú pháp nghiêm ngặt và tha thứ, hãy xem hướng dẫn phân tích cú pháp

Parsing two digit years

Theo mặc định, năm có hai chữ số trên 68 được coi là vào những năm 1900 và những năm từ 68 trở xuống được coi là vào những năm 2000. Điều này có thể được thay đổi bằng cách thay thế phương thức

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
733. Đối số duy nhất của phương thức này là một chuỗi chứa hai năm do người dùng nhập vào và sẽ trả về năm dưới dạng số nguyên

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
63

Phân tích cú pháp giờ và phút được dán

From version 2. 11. 0 phân tích cú pháp

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
734,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
735,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
736 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
737 được hỗ trợ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
64

String + Formats 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
65

If you don't know the exact format of an input string, but know it could be one of many, you can use an array of formats

This is the same as String + Format, only it will try to match the input to multiple formats

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
66

Starting in version 2. 3. 0, Moment uses some simple heuristics to determine which format to use. In order

  • Prefer formats resulting in valid dates over invalid ones
  • Prefer formats that parse more of the string than less and use more of the format than less, i. e. prefer stricter parsing
  • Prefer formats earlier in the array than later
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
67

You may also specify a locale and strictness argument. They work the same as the single format case

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
68

Note. Parsing multiple formats is considerably slower than parsing a single format. If you can avoid it, it is much faster to parse a single format

Array 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
69

You can create a moment with an array of numbers that mirror the parameters passed to new Date[]

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
738

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
70

Any value past the year is optional, and will default to the lowest possible number

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
71

Construction with an array will create a date in the current time zone. To create a date from an array at UTC, use

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
739

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
72

Note. Because this mirrors the native

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
74 parameters, months, hours, minutes, seconds, and milliseconds are all zero indexed. Years and days of the month are 1 indexed

This is often the cause of frustration, especially with months, so take note

If the date represented by the array does not exist,

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
628 will return false

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
73

UTC 1. 5. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
74

By default, moment parses and displays in local time

If you want to parse or display a moment in UTC, you can use

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
732 instead of
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
731

This brings us to an interesting feature of Moment. js. UTC mode

While in UTC mode, all display methods will display in UTC time instead of local time

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
75

Additionally, while in UTC mode, all getters and setters will internally use the

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
744 and
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
745 methods instead of the
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
746 and
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
747 methods

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
76

It is important to note that though the displays differ above, they are both the same moment in time

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
77

Any moment created with

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
732 will be in UTC mode, and any moment created with
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
731 will not

To switch from UTC to local time, you can use moment#utc or moment#local

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
78

parseZone 2. 3. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
79

Moment's string parsing functions like

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
750 and
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
751 accept offset information if provided, but convert the resulting Moment object to local or UTC time. In contrast,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
752 parses the string but keeps the resulting Moment object in a fixed-offset timezone with the provided offset in the string

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
90

It also allows you to pass locale and strictness arguments

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
91

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
753 is equivalent to parsing the string and using
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
754 to parse the zone

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
92

Validation 1. 7. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
93

Moment applies stricter initialization rules than the

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
74 constructor

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
94

You can check whether the Moment considers the date invalid using

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
628. You can check the metrics used by
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
757 using
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
758, which returns an object

The following parsing flags result in an invalid date

  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    759. An overflow of a date field, such as a 13th month, a 32nd day of the month [or a 29th of February on non-leap years], a 367th day of the year, etc.
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    759 contains the index of the invalid unit to match
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    761 [see below];
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    762 means no overflow
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    763. An invalid month name, such as
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    764. Contains the invalid month string itself, or else null
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    765. An input string that contains nothing parsable, such as
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    766. Boolean
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    767. A
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    768 input, like
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    769. Boolean
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    770. An empty list of formats, such as
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    771. Boolean
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    772. A date created explicitly as invalid, such as
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    773. Boolean

In addition to the above, As of 2. 13. 0 the meridiem and parsedDateParts flags work together to determine date validity

  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    774. Indicates what meridiem [AM/PM] was parsed, if any. String
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    775. Returns an array of date parts parsed in descending order - i. e. parsedDateParts[0] === year. If no parts are present, but meridiem has value, date is invalid. Array

Additionally, if the Moment is parsed in strict mode, these flags must be empty for the Moment to be valid

  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    776. array of format substrings not found in the input string
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    777. array of input substrings not matched to the format string

Note. Moment's concept of validity became more strict and consistent between 2. 2 and 2. 3. Note. Validity is determined on moment creation. A modified moment [i. e.

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
778] will remain valid

Additionally, you can use

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
779 to determine which date unit overflowed

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
95

The return value has the following meaning

  1. years
  2. months
  3. days
  4. hours
  5. minutes
  6. seconds
  7. milliseconds

Note. In case of multiple wrong units the first one is returned [because days validity may depend on month, for example]

Invalid Moments

If a moment is invalid, it behaves like a NaN in floating point operations

All of the following produce invalid moments

  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    780
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    781
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    782
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    783
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    784
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    785
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    786
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    787
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    788
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    789
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    790
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    791

The following produce a localized version of

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
792

  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    793 results in
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    794 in the current locale
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    795
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    796
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    797
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    798
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    799
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    900
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    901 [Before 2. 18. 0]
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    902

The following return

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
903

  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    904
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    905
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    906
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    907
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    908
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    909
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    910
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    911
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    912
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    913
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    914
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    915
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    916
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    917
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    918
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    919
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    920

And these return

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
768 or
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
922 with some structure

  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    923 returns null, as all other named getters
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    924
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    925 has all values set to
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    922
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    927 returns an invalid Date object
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    928 returns null
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    929 returns null
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    930 returns null
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    901 returns null [As of 2. 18. 0]

Add 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
96

Mutates the original moment by adding time

This is a pretty robust function for adding time to an existing moment. To add time, pass the key of what time you want to add, and the amount you want to add

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
97

There are some shorthand keys as well if you're into that whole brevity thing

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
98KeyShorthandyearsyquartersQmonthsMweekswdaysdhourshminutesmsecondssmillisecondsms

If you want to add multiple different keys at the same time, you can pass them in as an object literal

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
99

There are no upper limits for the amounts, so you can overload any of the parameters

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
00

Special considerations for months and years

If the day of the month on the original date is greater than the number of days in the final month, the day of the month will change to the last day in the final month

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
01

There are also special considerations to keep in mind when adding time that crosses over daylight saving time. If you are adding years, months, weeks, or days, the original hour will always match the added hour

Adding a month will add the specified number of months to the date

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
02
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
03

If you are adding hours, minutes, seconds, or milliseconds, the assumption is that you want precision to the hour, and will result in a different hour

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
04

Alternatively, you can use durations to add to moments

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
05

Before version 2. 8. 0, the

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
932 syntax was also supported. It has been deprecated in favor of
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
933

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
06

As of 2. 12. 0 when decimal values are passed for days and months, they are rounded to the nearest integer. Weeks, quarters, and years are converted to days or months, and then rounded to the nearest integer

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
07

Start of Time 1. 7. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
08

Mutates the original moment by setting it to the start of a unit of time

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
09

These shortcuts are essentially the same as the following

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
10
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
11

As of version 2. 0. 0,

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
934 replaced
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
935

Note.

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
936 was added in version 2. 0. 0

As of version 2. 1. 0,

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
936 uses the locale aware week start day

Note.

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
938 was added in version 2. 2. 0

Note.

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
939 was added as an alias for day in 2. 13. 0

UTC offset 2. 9. 0++

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
12

Nhận hoặc đặt phần bù UTC sau vài phút

Ghi chú. Không giống như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
940, hàm này trả về phần bù thực từ UTC, không phải phần bù ngược [như được trả về bởi
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
941]

Lấy

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
942 của đối tượng hiện tại

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
13

Đặt phần bù UTC bằng cách cung cấp số phút. Phần bù được đặt trên đối tượng thời điểm mà

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
943 được gọi trên. Nếu bạn muốn đặt phần bù trên toàn cầu, hãy thử sử dụng múi giờ. Lưu ý rằng khi bạn đặt giá trị bù, giá trị đó sẽ cố định và sẽ không tự thay đổi [i. e không có quy tắc DST]. Nếu bạn muốn múi giờ thực tế -- thời gian ở một địa điểm cụ thể, chẳng hạn như
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
944, hãy xem xét múi giờ-thời điểm

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
14

Nếu đầu vào nhỏ hơn

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
945 và lớn hơn
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
946, thay vào đó, nó sẽ hiểu thông tin đầu vào của bạn là giờ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
15

Cũng có thể đặt độ lệch UTC từ một chuỗi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
16

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
754 sẽ tìm kiếm chuỗi cho trận đấu cuối cùng của
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
948, do đó, bạn thậm chí có thể chuyển một chuỗi được định dạng ISO8601 với phần bù và thời điểm sẽ được thay đổi thành phần bù UTC đó

Lưu ý rằng nếu chuỗi không bao gồm 'Z', nó phải bao gồm ký tự

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
949 hoặc
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
950

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
17

Hàm

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
942 có tham số thứ hai tùy chọn chấp nhận giá trị boolean cho biết có giữ thời gian hiện có trong ngày hay không

  • Vượt qua

    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    903 [mặc định] sẽ giữ nguyên thời gian trong Giờ quốc tế, nhưng giờ địa phương sẽ thay đổi

  • Vượt qua

    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    953 sẽ giữ nguyên giờ địa phương, nhưng phải trả giá bằng việc chọn một điểm khác trong Giờ quốc tế

Một cách sử dụng tính năng này là nếu bạn muốn xây dựng một khoảnh khắc với độ lệch múi giờ cụ thể chỉ bằng các giá trị đầu vào số

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
18

Định dạng 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
19

Đây là tùy chọn hiển thị mạnh mẽ nhất. It takes a string of tokens and replaces them with their corresponding values

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
20TokenOutputMonthM1 2 . 11 12Mo1st 2nd . 11th 12thMM01 02 . 11 12MMMJan Feb . Nov DecMMMMJanuary February . November DecemberQuarterQ1 2 3 4Qo1st 2nd 3rd 4thDay of MonthD1 2 . 30 31Do1st 2nd . 30 ngày 31DD01 02. 30 31Day of YearDDD1 2 . 364 365DDDo1st 2nd . 364th 365thDDDD001 002 . 364 365Day of Weekd0 1 . 5 6do0th 1st . 5th 6thddSu Mo . Fr SadddSun Mon . Fri SatddddSunday Monday . Friday SaturdayDay of Week [Locale]e0 1 . 5 6Day of Week [ISO]E1 2 . 6 7Week of Yearw1 2 . 52 53wo1st 2nd . 52nd 53rdww01 02 . 52 53Week of Year [ISO]W1 2 . 52 53Wo1st 2nd . 52nd 53rdWW01 02 . 52 53YearYY70 71 . 29 30YYYY1970 1971 . 2029 2030YYYYYY-001970 -001971 . +001907 +001971
Note. Expanded Years [Covering the full time value range of approximately 273,790 years forward or backward from 01 January, 1970]Y1970 1971 . 9999 +10000 +10001
Note. This complies with the ISO 8601 standard for dates past the year 9999Era Yeary1 2 . 2020 . EraN, NN, NNNBC AD
Note. Abbr era nameNNNNBefore Christ, Anno Domini
Note. Full era nameNNNNNBC AD
Note. Narrow era nameWeek Yeargg70 71 . 29 30gggg1970 1971 . 2029 2030Week Year [ISO]GG70 71 . 29 30GGGG1970 1971 . 2029 2030AM/PMAAM PMaam pmHourH0 1 . 22 23HH00 01 . 22 23h1 2 . 11 12hh01 02 . 11 12k1 2 . 23 24kk01 02 . 23 24Minutem0 1 . 58 59mm00 01 . 58 59Seconds0 1 . 58 59ss00 01 . 58 59Fractional SecondS0 1 . 8 9SS00 01 . 98 99SSS000 001 . 998 999SSSS . SSSSSSSSS000[0. ] 001[0. ] . 998[0. ] 999[0. ]Time Zonez or zzEST CST . MST PST
Note. kể từ 1. 6. 0, mã thông báo định dạng z/zz không được dùng nữa từ các đối tượng thời điểm đơn giản. Read more about it here. However, they *do* work if you are using a specific time zone with the moment-timezone addon. Z-07. 00 -06. 00 . +06. 00 +07. 00ZZ-0700 -0600 . +0600 +0700Unix TimestampX1360013296Unix Millisecond Timestampx1360013296123

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
650 was added in 2. 0. 0

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
955 were added in 2. 1. 0

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
652 was added in 2. 8. 4

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
715 to
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
958 were added in 2. 10. 5. Chúng hiển thị 3 chữ số có nghĩa và phần còn lại chứa đầy số không

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
959 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
960 đã được thêm vào 2. 13. 0

Định dạng bản địa hóa

Vì định dạng ưa thích khác nhau dựa trên ngôn ngữ, nên có một số mã thông báo có thể được sử dụng để định dạng một khoảnh khắc dựa trên ngôn ngữ của nó

Có các biến thể chữ hoa và chữ thường trên cùng một định dạng. Phiên bản chữ thường được dự định là phiên bản rút gọn của đối tác chữ hoa của nó

Thời gianLT8. 30 PM Thời gian tính bằng giây LTR8. 30. 25 giờ chiềuSố tháng, ngày tháng, nămL09/04/1986l9/4/1986Tên tháng, ngày tháng, nămLL 4/9/1986ll4/9/1986Tên tháng, ngày tháng, năm, giờLL 4/9/1986 8. 30 PMlllNgày 4 tháng 9 năm 1986 8. 30 giờ chiềuTên tháng, ngày trong tháng, ngày trong tuần, năm, giờLLLLThứ năm, ngày 4 tháng 9 năm 1986 8. 30 PMllllThu, ngày 4 tháng 9 năm 1986 8. 30 giờ chiều

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
961 có sẵn trong 2. 0. 0.
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
677 đã được thêm vào 2. 8. 4

Nhân vật trốn thoát

Để thoát các ký tự trong chuỗi định dạng, bạn có thể đặt các ký tự trong dấu ngoặc vuông

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
21

Điểm tương đồng và khác biệt với LDLML

Ghi chú. Mặc dù các định dạng ngày này rất giống với các định dạng ngày của LDML, nhưng có một số khác biệt nhỏ liên quan đến ngày trong tháng, ngày trong năm và ngày trong tuần

Để biết bảng phân tích về một số mã thông báo định dạng ngày khác nhau trên các ngôn ngữ khác nhau, hãy xem biểu đồ mã thông báo định dạng ngày này

tốc độ định dạng

Để so sánh Khoảnh khắc. js so với các thư viện khác, hãy xem phần so sánh này với các thư viện khác

Các mã thông báo khác

Nếu bạn cảm thấy thoải mái hơn khi làm việc với strftime thay vì mã thông báo phân tích cú pháp giống như LDML, bạn có thể sử dụng plugin của Ben Oakes. benjaminoakes/khoảnh khắc

định dạng mặc định

Gọi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
629 không có định dạng sẽ mặc định là
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
964. Ngoài hộp, ________ 5964 là định dạng ISO 8601 ________ 5966

Kể từ phiên bản 2. 13. 0, khi ở chế độ UTC, định dạng mặc định được điều chỉnh bởi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
967 có định dạng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
968. Điều này trả về
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
626 làm phần bù, thay vì
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
970

Trong một số trường hợp nhất định, múi giờ địa phương [chẳng hạn như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
971] có thể có độ lệch bằng 0 và sẽ được coi là UTC. Trong những trường hợp như vậy, có thể hữu ích khi đặt
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
964 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
967 để sử dụng cùng một định dạng

Thay đổi giá trị của

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
964 sẽ chỉ ảnh hưởng đến định dạng và sẽ không ảnh hưởng đến phân tích cú pháp. Ví dụ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
22

Thời gian tính từ bây giờ 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
23

Một cách phổ biến để hiển thị thời gian được xử lý bởi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
975. Điều này đôi khi được gọi là timeago hoặc thời gian tương đối

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
24

Nếu bạn vượt qua

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
953, bạn có thể nhận được giá trị mà không cần hậu tố

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
25

Các chuỗi cơ sở được tùy chỉnh theo ngôn ngữ hiện tại. Thời gian được làm tròn đến giây gần nhất

Bảng phân tích chuỗi nào được hiển thị trong mỗi khoảng thời gian được nêu trong bảng bên dưới

RangeKeySample Output0 đến 44 giâysa vài giây trướcunsetss44 giây trước45 đến 89 giâyma phút trước90 giây đến 44 phútmm2 phút trước. 44 phút trước45 đến 89 phútshan giờ trước90 phút đến 21 giờhh2 giờ trước. 21 giờ trước22 đến 35 giờda ngày trước36 giờ đến 25 ngàydd2 ngày trước. 25 ngày trước26 đến 45 ngàyMa tháng trước45 đến 319 ngàyMM2 tháng trước. 10 tháng trước320 tới 547 ngày [1. 5 năm] hoặc năm trước 548 ngày+yy2 năm trước. 20 năm trước

Ghi chú. Từ phiên bản 2. 10. 3, nếu đối tượng thời điểm đích không hợp lệ, kết quả là chuỗi ngày không hợp lệ được bản địa hóa

Ghi chú. Khóa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
977 đã được thêm vào 2. 18. 0. Đó là một ngưỡng tùy chọn. Nó sẽ không bao giờ hiển thị TRỪ KHI người dùng đặt ngưỡng ss theo cách thủ công. Cho đến khi ngưỡng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
977 được đặt, nó sẽ mặc định là giá trị của ngưỡng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
979 trừ đi 1 [do đó, người dùng không nhìn thấy được]

Đến giờ 2. 10. 3+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
26

Một cách phổ biến để hiển thị thời gian được xử lý bởi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
980. Điều này đôi khi được gọi là timeago hoặc thời gian tương đối

Điều này tương tự với

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
981, nhưng đưa ra khoảng thời gian ngược lại.
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
982

Điều này tương tự như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
983, nhưng là trường hợp đặc biệt cho thời điểm hiện tại. Sử dụng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
983, nếu bạn muốn kiểm soát hai điểm cuối của khoảng thời gian

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
27

Nếu bạn vượt qua

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
953, bạn có thể nhận giá trị mà không cần tiền tố

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
28

Các chuỗi cơ sở được tùy chỉnh theo ngôn ngữ hiện tại

Bảng phân tích chuỗi nào được hiển thị trong mỗi khoảng thời gian được nêu trong bảng bên dưới

RangeKeySample Output0 đến 44 giây trong giây45 đến 89 giâyphút một phút90 giây đến 44 phútmmin 2 phút. trong 44 phút45 đến 89 phút hin một giờ90 phút đến 21 giờ hin 2 giờ. trong 21 giờ22 đến 35 giờ trong một ngày36 giờ đến 25 ngàyddin 2 ngày. trong 25 ngày26 đến 45 ngàyTối thiểu một tháng45 đến 319 ngàyMMTối thiểu 2 tháng. trong 10 tháng320 đến 547 ngày [1. 5 năm] âm một năm548 ngày+yyin 2 năm. Trong 20 năm

Từ phiên bản 2. 10. 3, nếu đối tượng thời điểm đích không hợp lệ, kết quả là chuỗi ngày không hợp lệ được bản địa hóa

Thời gian theo lịch 1. 3. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
29

Thời gian trên lịch hiển thị thời gian tương ứng với một

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
986 nhất định [mặc định là bắt đầu từ ngày hôm nay], nhưng hiển thị hơi khác so với
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
975

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
988 sẽ định dạng một ngày với các chuỗi khác nhau tùy thuộc vào mức độ gần với ngày của
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
986 [theo mặc định là ngày hôm nay].

Tuần trước Thứ Hai tuần trước lúc 2. 30 Ngày hôm trước Hôm qua lúc 2. 30 AMP Cùng ngày Hôm nay lúc 2. 30 AMNgày hôm sauNgày mai lúc 2. 30 AMTuần tớiChủ nhật lúc 2. 30 AMMọi thứ khác7/10/2011

Các chuỗi này được bản địa hóa và có thể được tùy chỉnh

từ 2. 10. 5 thời điểm hỗ trợ chỉ định định dạng đầu ra lịch cho mỗi lần gọi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
70

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
990 được sử dụng làm định dạng khi thời điểm cách
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
986 hơn một tuần

Ghi chú. Từ phiên bản 2. 14. 0, đối số định dạng cho lịch có thể là lệnh gọi lại được thực thi trong ngữ cảnh thời điểm với một đối số duy nhất ngay bây giờ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
71

Ghi chú. Từ phiên bản 2. 25. 0, bạn chỉ có thể truyền đối số định dạng, nó có thể là đối tượng của chuỗi và hàm

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
72

Sự khác biệt 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
73

Để có sự khác biệt tính bằng mili giây, hãy sử dụng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
992 giống như bạn sẽ sử dụng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
993

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
74

Để có được sự khác biệt trong một đơn vị đo lường khác, hãy chuyển phép đo đó làm đối số thứ hai

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
75

Để có được khoảng thời gian chênh lệch giữa hai khoảnh khắc, bạn có thể chuyển

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
994 làm đối số thành
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
995. Xem tài liệu trên moment#duration để biết thêm thông tin

Các phép đo được hỗ trợ là

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
996,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
997,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
998,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
999,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
000,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
001 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
002. Để dễ phát triển, các dạng số ít được hỗ trợ kể từ 2. 0. 0. Các đơn vị đo lường khác với mili giây có sẵn trong phiên bản 1. 1. 1

Theo mặc định,

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
992 sẽ cắt bớt kết quả đến 0 chữ số thập phân, trả về một số nguyên. Nếu bạn muốn một số dấu phẩy động, hãy chuyển
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
953 làm đối số thứ ba. trước 2. 0. 0,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
992 trả về một số được làm tròn thành số nguyên gần nhất, không phải số bị cắt bớt

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
76

Nếu thời điểm này sớm hơn thời điểm bạn chuyển đến

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
006, giá trị trả về sẽ là số âm

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
77

Một cách dễ dàng để nghĩ về điều này là thay thế

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
007 bằng một toán tử trừ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
78

Tháng và năm khác nhau

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
992 có một số cách xử lý đặc biệt đối với chênh lệch tháng và năm. Nó được tối ưu hóa để đảm bảo rằng hai tháng có cùng ngày luôn cách nhau một số nguyên

Vì vậy, ngày 15 tháng 1 đến ngày 15 tháng 2 phải đúng 1 tháng

28/02 đến 28/03 chắc là đúng 1 tháng

Ngày 28 tháng 2 năm 2011 đến ngày 28 tháng 2 năm 2012 phải đúng 1 năm

Xem thêm thảo luận về chênh lệch tháng và năm tại đây

Sự thay đổi khác biệt giữa tháng và năm này được thực hiện trong 2. 0. 0. Kể từ phiên bản 2. 9. 0 diff cũng hỗ trợ đơn vị quý

Có trước 2. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
79

Kiểm tra xem một khoảnh khắc có trước một khoảnh khắc khác không. Đối số đầu tiên sẽ được phân tích cú pháp như một khoảnh khắc, nếu chưa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
00

Nếu bạn muốn giới hạn mức độ chi tiết ở một đơn vị khác với mili giây, hãy chuyển các đơn vị làm tham số thứ hai

Vì tham số thứ hai xác định độ chính xác và không chỉ kiểm tra một giá trị duy nhất, sử dụng ngày sẽ kiểm tra năm, tháng và ngày

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
01

Giống như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
009 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
010, bất kỳ đơn vị thời gian nào được hỗ trợ cho ________ 6011 đều được hỗ trợ cho ________ 6012

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
02

Nếu không có gì được chuyển đến

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
012, nó sẽ mặc định là thời điểm hiện tại

GHI CHÚ.

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
014 có hành vi không xác định và không nên được sử dụng. Nếu mã chạy nhanh, thời điểm được tạo ban đầu sẽ giống với thời điểm được tạo trong is Before để thực hiện kiểm tra, do đó, kết quả sẽ là
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
903. Nhưng nếu mã chạy chậm hơn, có thể thời điểm được tạo trong is Before có thể đo được sau thời điểm được tạo trong
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
731, vì vậy lệnh gọi sẽ trả về
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
953

Giống nhau 2. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
03

Kiểm tra xem một khoảnh khắc có giống với một khoảnh khắc khác không. Đối số đầu tiên sẽ được phân tích cú pháp như một khoảnh khắc, nếu chưa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
04

Nếu bạn muốn giới hạn mức độ chi tiết ở một đơn vị khác với mili giây, hãy chuyển nó làm tham số thứ hai

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
05

Khi bao gồm tham số thứ hai, nó sẽ khớp với tất cả các đơn vị bằng hoặc lớn hơn. Vượt qua trong

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
018 sẽ kiểm tra
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
018 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
020. Vượt qua
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
021 sẽ kiểm tra
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
021,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
018 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
020

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
06

Giống như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
009 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
012, bất kỳ đơn vị thời gian nào được hỗ trợ cho
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
011 đều được hỗ trợ cho
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
010

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
02

Nếu hai thời điểm có múi giờ khác nhau thì múi giờ của thời điểm đầu tiên sẽ được dùng để so sánh

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
08

GHI CHÚ.

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
029 có hành vi không xác định và không nên được sử dụng. Nếu mã chạy nhanh, thời điểm được tạo ban đầu sẽ giống với thời điểm được tạo trong isSame để thực hiện kiểm tra, vì vậy kết quả sẽ là
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
953. Nhưng nếu mã chạy chậm hơn thì có thể đo được thời điểm được tạo trong isSame sau thời điểm được tạo trong
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
731, do đó lệnh gọi sẽ trả về
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
903

Nằm giữa 2. 9. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
09

Kiểm tra xem một khoảnh khắc có nằm giữa hai khoảnh khắc khác hay không, tùy ý xem theo tỷ lệ đơn vị [phút, giờ, ngày, v.v.]. Trận đấu là độc quyền. Hai đối số đầu tiên sẽ được phân tích cú pháp dưới dạng khoảnh khắc, nếu chưa được như vậy

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
00

Lưu ý rằng thứ tự của hai đối số quan trọng. ngày "nhỏ hơn" phải ở đối số đầu tiên

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
01

Nếu bạn muốn giới hạn mức độ chi tiết ở một đơn vị khác với mili giây, hãy chuyển các đơn vị này làm tham số thứ ba

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
02

Giống như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
010,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
012,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
009 bất kỳ đơn vị thời gian nào được hỗ trợ cho
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
011 đều được hỗ trợ cho
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
037. Năm, tháng, tuần, isoWeek, ngày, giờ, phút và giây

Phiên bản 2. 13. 0 giới thiệu tính toàn diện. Một

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
038 cho biết bao gồm một giá trị. Một
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
039 biểu thị loại trừ. Nếu tham số bao gồm được sử dụng, cả hai chỉ số phải được thông qua

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
03

Lưu ý rằng trong trường hợp các tham số

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
040 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
041 giống nhau, nhưng các tham số bao gồm khác nhau, sai sẽ chiếm ưu thế

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
04

Nếu tham số bao gồm không được chỉ định, Moment sẽ mặc định là

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
042

Là Giờ mùa hè 1. 2. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
05

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
043 kiểm tra xem thời điểm hiện tại có phải là giờ mùa hè không

GHI CHÚ. Chức năng này là một HACK. thời điểm không có cách nào để biết liệu một thời điểm nhất định có ở DST thực tế hay không. Một số thay đổi về thời gian trong một vùng có liên quan đến DST, một số thì không và không có thông tin múi giờ hoàn chỉnh thì không thể biết được

Khoảnh khắc hiện đang kiểm tra thời gian mùa đông và mùa hè, và nếu phần bù khớp với phần bù mùa hè [và thời gian nghỉ hè khác với thời gian nghỉ mùa đông], thì nó sẽ báo cáo DST. Điều này hoạt động trong phần lớn các trường hợp, nhưng như đã đề cập ở trên, không "chính xác" và sẽ không hoạt động trong mọi trường hợp. Vì vậy, đừng đến với chúng tôi phàn nàn

Múi giờ thời điểm sự kiện [tại thời điểm viết 0. 5. 37] không hỗ trợ thông tin DST [i. e có phải là đồng hồ chính thức trong DST tại một thời điểm nhất định hay không], vì vậy để mọi thứ trở nên tốt hơn, một số nội dung mới [và gói tzdata] phải diễn ra theo múi giờ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
06

Thay đổi ngôn ngữ trên toàn cầu 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
07

Theo mặc định, Khoảnh khắc. js đi kèm với chuỗi ngôn ngữ tiếng Anh [Hoa Kỳ]. Nếu bạn cần các ngôn ngữ khác, bạn có thể tải chúng vào Khoảnh khắc. js để sử dụng sau

Để tải một ngôn ngữ, hãy chuyển khóa và các giá trị chuỗi tới

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
044

Bạn có thể tìm thêm chi tiết về từng phần của gói ngôn ngữ trong phần tùy chỉnh

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
08

Thông tin chi tiết về

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
045 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
046 có thể được tìm thấy trong phần tùy chỉnh

Sau khi bạn tải một ngôn ngữ, nó sẽ trở thành ngôn ngữ hoạt động. Để thay đổi ngôn ngữ đang hoạt động, chỉ cần gọi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
044 bằng khóa của ngôn ngữ đã tải

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
09

kể từ 2. 21. 0, Khoảnh khắc sẽ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
048 nếu ngôn ngữ không khả dụng

kể từ 2. 8. 0, việc thay đổi ngôn ngữ chung không ảnh hưởng đến các phiên bản hiện có

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
10

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
044 trả về ngôn ngữ được sử dụng. Điều này hữu ích vì Khoảnh khắc sẽ không thay đổi ngôn ngữ nếu nó không biết ngôn ngữ bạn chỉ định

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
11

Bạn cũng có thể chỉ định một danh sách các ngôn ngữ và Moment sẽ sử dụng danh sách đầu tiên mà nó có bản địa hóa cho

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
12

Moment cũng sẽ thử các chuỗi con của trình xác định ngôn ngữ từ cụ thể nhất đến ít cụ thể nhất cho đến khi tìm thấy một ngôn ngữ mà nó biết. Điều này hữu ích khi cung cấp Khoảnh khắc bằng chuỗi ngôn ngữ được lấy từ môi trường của người dùng, chẳng hạn như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
050

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
13

Cuối cùng, Moment sẽ tìm kiếm một cách thông minh thông qua một loạt các ngôn ngữ và chuỗi con của chúng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
14

Logic hoạt động như sau -- ngôn ngữ tiếp theo được chọn và thử nguyên trạng. Nếu không thành công, mã thường cố gắng cắt bit cuối cùng [thường là ký hiệu quốc gia] và thử lại. Tuy nhiên, nếu phần tử mảng tiếp theo có tiền tố giống hoặc dài hơn phần tử được thử, thì quá trình lặp lại tiếp tục. Vì vậy, ví dụ nếu mảng có trình tự

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
15

sau đó thử "AA-BB" đầu tiên, sau đó một giải pháp ngây thơ sẽ thử "AA", nhưng thay vào đó, giải pháp này sẽ kiểm tra xem "AA-CC" thực sự cụ thể hơn "AA", vì vậy, nó thử "AA-CC" . Vì vậy, cuối cùng, các ngôn ngữ sau được thử theo thứ tự này [giả sử tất cả đều không thành công nên ngôn ngữ tiếp theo sẽ được thử]

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
16

Thay đổi ngôn ngữ cục bộ 1. 7. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
17

Cấu hình ngôn ngữ chung có thể gặp sự cố khi chuyển qua các khoảnh khắc có thể cần được định dạng thành ngôn ngữ khác

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
18

Nếu bạn gọi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
051 mà không có tham số, bạn sẽ lấy lại cấu hình ngôn ngữ sẽ được sử dụng cho thời điểm đó

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
19

Nếu bạn cần truy cập dữ liệu ngôn ngữ trong giây lát, đây là cách ưu tiên để làm như vậy

kể từ 2. 3. 0, bạn cũng có thể chỉ định một mảng các mã định danh ngôn ngữ. Nó hoạt động giống như trong cấu hình ngôn ngữ toàn cầu

Liệt kê các tháng và ngày trong tuần của Khoảnh khắc hiện tại. ngôn ngữ js 2. 3. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
20

Đôi khi, rất hữu ích khi lấy danh sách các tháng hoặc ngày trong tuần ở một ngôn ngữ, chẳng hạn như khi điền vào menu thả xuống

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
21

Trả về danh sách các tháng ở ngôn ngữ hiện tại

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
22

Tương tự,

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
052 trả về tên tháng viết tắt và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
053,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
054,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
055 trả về danh sách các ngày trong tuần

Bạn có thể chuyển một số nguyên vào từng hàm đó để biết tháng hoặc ngày trong tuần cụ thể

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
23

kể từ 2. 13. 0, bạn có thể chuyển một bool làm tham số đầu tiên của các hàm ngày trong tuần. Nếu đúng, các ngày trong tuần sẽ được trả về theo thứ tự ngôn ngữ cụ thể. Chẳng hạn, trong tiếng Ả Rập, Thứ Bảy là ngày đầu tiên trong tuần, do đó

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
24

Ghi chú. Không có tham số cụ thể của ngôn ngữ, các ngày trong tuần luôn có Chủ nhật là chỉ số 0, bất kể ngày đầu tuần của địa phương đó là gì

Một số địa phương đưa ra những cân nhắc đặc biệt khi định dạng tên tháng. Ví dụ: định dạng tiếng Hà Lan viết tắt tháng không có dấu chấm, nhưng chỉ khi nó định dạng tháng giữa các dấu gạch ngang. Phương thức

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
997 hỗ trợ chuyển định dạng để các tháng sẽ được liệt kê trong ngữ cảnh phù hợp

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
25

Và cuối cùng, bạn có thể kết hợp cả tùy chọn định dạng và tùy chọn số nguyên

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
26

Truy cập chức năng dành riêng cho ngôn ngữ 2. 8. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
27

Bạn có thể truy cập các thuộc tính của ngôn ngữ hiện được tải thông qua chức năng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
057. Nó trả về ngôn ngữ hiện tại hoặc một ngôn ngữ với khóa đã cho

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
28

Đối tượng được trả về có các phương thức sau

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
29

Thông tin chi tiết về

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
058 có thể được tìm thấy trong phần tùy chỉnh

Khoảng khăc. js rất dễ tùy chỉnh. Nói chung, bạn nên tạo cài đặt ngôn ngữ với các tùy chỉnh của mình

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
30

Bạn có thể xóa một ngôn ngữ đã xác định trước đó bằng cách chuyển

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
768 làm đối số thứ hai. Ngôn ngữ đã xóa sẽ không còn khả dụng để sử dụng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
31

kể từ 2. 12. 0, có thể tạo ngôn ngữ kế thừa từ ngôn ngữ gốc

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
32

Các thuộc tính không được chỉ định trong ngôn ngữ sẽ được kế thừa từ ngôn ngữ gốc

kể từ 2. 16. 0, có thể xác định ngôn ngữ có cha mẹ chưa được xác định hoặc tải

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
33

kể từ 2. 21. 0 khi cố gắng tạo một khoảnh khắc với ngôn ngữ mới được xác định, khoảnh khắc sẽ cố tải cha mẹ xuống nếu nó tồn tại. Không thành công, nó sẽ mặc định cha mẹ thành ngôn ngữ toàn cầu

kể từ 2. 12. 0 cũng có thể cập nhật các thuộc tính của ngôn ngữ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
34

Bất kỳ thuộc tính nào được chỉ định sẽ được cập nhật, trong khi các thuộc tính khác sẽ giữ nguyên. Chức năng này không ảnh hưởng đến những khoảnh khắc đã tồn tại. Lưu ý rằng việc gọi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
060 cũng thay đổi ngôn ngữ toàn cầu hiện tại thành ngôn ngữ được cập nhật;

Để hoàn nguyên một bản cập nhật, hãy sử dụng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
35

2. 12. 0 không dùng nữa bằng cách sử dụng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
643 để thay đổi ngôn ngữ hiện có. Sử dụng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
062 để thay thế

Tên tháng 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
36

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
063 phải là một mảng tên tháng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
37

Nếu bạn cần xử lý nhiều hơn để tính tên của tháng, [ví dụ: nếu có các ngữ pháp khác nhau cho các định dạng khác nhau], thì

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
063 có thể là một hàm có chữ ký sau. Nó phải luôn trả về một tên tháng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
38

Từ phiên bản 2. 11. 0 tháng cũng có thể là một đối tượng, chỉ định các hình thức

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
065 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
066 [chỉ định và buộc tội]. Biểu thức chính quy được chạy trên định dạng để kiểm tra xem có sử dụng biểu mẫu
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
066 hay không là
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
068. Từ phiên bản 2. 14. 0 một số khác có thể được chỉ định bằng phím
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
069

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
39

Tên ngày trong tuần 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
40

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
070 phải là một mảng tên các ngày trong tuần

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
41

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
070 cũng có thể là một chức năng gọi lại

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
42

Ghi chú. Từ phiên bản 2. 11. 0 định dạng/trường hợp độc lập cũng có thể được thông qua.

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
069 sẽ được sử dụng đối với chuỗi định dạng đầy đủ để xác định nên sử dụng biểu mẫu nào

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
43

Thời gian tương đối 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
44

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
073 phải là một đối tượng của chuỗi thay thế cho
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
993

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
45

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
075 refers to the prefix/suffix for future dates, and
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
076 refers to the prefix/suffix for past dates. For all others, a single character refers to the singular, and a double character refers to the plural

If a locale requires additional processing for a token, it can set the token as a function with the following signature. The function should return a string

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
46

The

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
077 argument refers to the replacement key in the
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
073 object. [eg.
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
079, etc. ]

The

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
080 argument refers to the number of units for that key. Đối với
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
081, số này là số phút, v.v.

Đối số

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
082 sẽ là đúng nếu mã thông báo sẽ được hiển thị mà không có hậu tố và sai nếu nó được hiển thị với hậu tố. [Lý do logic đảo ngược là vì hành vi mặc định là hiển thị với hậu tố. ]

Đối số

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
083 sẽ đúng nếu nó sẽ sử dụng hậu tố/tiền tố tương lai và sai nếu nó sẽ sử dụng tiền tố/hậu tố quá khứ

Ghi chú. Xử lý cho

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
084 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
085 đã được thêm vào 2. 25. 0

Ngưỡng thời gian tương đối 2. 7. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
47

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
086 có các ngưỡng xác định thời điểm một đơn vị được coi là phút, giờ, v.v. Ví dụ: theo mặc định, hơn 45 giây được coi là một phút, hơn 22 giờ được coi là một ngày, v.v. Để thay đổi các giới hạn đó, hãy sử dụng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
087 trong đó đơn vị là một trong số
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
977,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
979,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
081,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
091,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
092,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
084,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
094

đơn vị nghĩa là số lần sử dụng là vài giây số giây nhỏ nhất được tính bằng giây, trừ 1. Phải được đặt sau khi đặt đơn vị `s` hoặc không đặt đơn vị `s`. ssecondsố giây ít nhất được coi là một phút. mminutes số phút ít nhất được coi là một giờ. hhourssố giờ ít nhất được coi là một ngày. ddaysít nhất số ngày được coi là một tuần. wweeksố tuần ít nhất được coi là một tháng. Không được sử dụng theo mặc định. Mtháng số tháng ít nhất được coi là một năm.
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
48

Ghi chú. Đơn vị tuần đã được thêm vào trong 2. 25. 0. Theo mặc định, nó không được sử dụng [đặt thành null], nhưng bạn có thể đặt thành giá trị khác null và cũng [tùy chọn] đặt

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
092 thấp hơn, để nó chuyển từ vài ngày sang vài tuần trước đó

Ghi chú. Truy xuất ngưỡng đã được thêm vào trong 2. 8. 1

Ghi chú. Truy xuất và đặt ngưỡng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
977 đã được thêm vào 2. 18. 0

Ngày đầu tuần và tuần đầu tiên của năm 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
49

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
097 phải là một số nguyên đại diện cho ngày đầu tiên của tuần, 0 là Chủ Nhật, 1 là Thứ Hai,. , 6 là thứ bảy

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
098 phải là một số nguyên.
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
099 được sử dụng cùng với
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
100 để xác định tuần đầu tiên của năm.
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
099 được tính là
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
102, trong đó
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
103 là ngày đầu tiên của tháng 1 phải thuộc tuần đầu tiên của năm

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
50

Thời đại 2. 25. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
51

Chỉ định thời đại cho một ngôn ngữ cụ thể. Một thời đại là một khoảng thời gian với tên và đánh số năm. Số năm tuyệt đối [như 2020] cũng có thể được chỉ định là 2020 AD. năm thứ 2020 của kỷ nguyên sau công nguyên. Tương tự, số năm tuyệt đối -0500 có thể được mô tả là 501 trước Công nguyên, năm thứ 501 kể từ thời đại trước Công nguyên

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
52

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
104 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
105 chi phối hướng đi của thời đại. Như trong trường hợp của
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
106, nó phát triển về phía
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
107, do đó
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
104 >
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
105. Đối với các thời đại tăng dần về phía +Vô cực ________ 6104 < ________ 6105

Phân tích cú pháp/định dạng thời đại được thực hiện bằng mã thông báo

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
112,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
113 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
114

Ghi chú. Các API liên quan đến thời đại có thể thay đổi

Đang tạo 1. 6. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
53

Để tạo khoảng thời gian, hãy gọi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
115 với khoảng thời gian tính bằng mili giây

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
54

Nếu bạn muốn tạo khoảnh khắc với đơn vị đo khác mili giây, bạn có thể truyền đơn vị đo cũng được

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
55

Cách viết tắt tương tự cho

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
116 và
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
117 cũng hoạt động ở đây

Phím Viết tắtnămsythángMtuầnswdaysdhourshminutesmsecondssmillisecondsms

Giống như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
116, bạn có thể truyền một đối tượng giá trị nếu bạn cần nhiều đơn vị đo lường khác nhau

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
56

kể từ 2. 1. 0, thời điểm hỗ trợ phân tích cú pháp ASP. NET phong cách khoảng thời gian. Các định dạng sau được hỗ trợ

Định dạng là một chuỗi giờ, phút, giây được phân tách bằng dấu hai chấm như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
119. Số ngày có thể được bắt đầu bằng dấu phân cách dấu chấm như vậy
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
120. Một phần giây cũng được hỗ trợ
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
121

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
57

kể từ 2. 3. 0, khoảnh khắc cũng hỗ trợ phân tích thời lượng ISO 8601

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
58

kể từ 2. 11. 0, chuỗi định dạng thời lượng có khoảng cách giữa ngày và phần còn lại được hỗ trợ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
59

kể từ 2. 13. 0, các dấu hiệu âm và dương hỗn hợp được hỗ trợ khi phân tích thời lượng

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
60

kể từ 2. 18. 0, thời lượng không hợp lệ được hỗ trợ, tương tự như thời điểm không hợp lệ. Để tạo khoảng thời gian không hợp lệ, bạn có thể chuyển

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
922 cho giá trị của một đơn vị

Trong các bản phát hành sắp tới, thời lượng không hợp lệ sẽ bao gồm nhiều trường hợp hơn [như giá trị null cho đơn vị]

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
61

Nhân hóa 1. 6. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
62

Đôi khi, bạn muốn tất cả những điều tốt đẹp của

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
993 nhưng bạn không muốn phải tạo hai khoảnh khắc, bạn chỉ muốn hiển thị một khoảng thời gian

Nhập

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
124

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
63

Theo mặc định, chuỗi trả về mô tả khoảng thời gian

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
125 [không có hậu tố]. Nếu bạn muốn thời lượng định hướng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
126,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
127 [có hậu tố], hãy chuyển true như bên dưới

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
64

Đối với các hậu tố trước đây, hãy chuyển vào một số âm

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
65

Thời lượng không hợp lệ được nhân hóa thành phiên bản địa phương hóa của

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
128

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
66

Đầu ra nhân hóa có thể được cấu hình với các ngưỡng thời gian tương đối. Để chỉ định các ngưỡng cho một lời gọi nhân hóa cụ thể, hãy chuyển chúng dưới dạng đối số duy nhất hoặc sau hậu tố arg

Chủ Đề