Định dạng getmtime python

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. Vì điều này đã được thực hiện trong các thư viện khác, chúng tôi cảm thấy rằng điều quan trọng hơn là giữ lại API có thể thay đổi

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ó. Khoảnh khắc không hoạt động tốt với các thuật toán "rung cây" hiện đại, do đó, nó có xu hướng tăng kích thước của gói ứng dụng web. Nếu một người cần hỗ trợ quốc tế hóa hoặc múi giờ, Moment có thể khá lớn. Các trình duyệt web hiện đại [và Node. js] hiển thị hỗ trợ quốc tế hóa và múi giờ thông qua đối tượ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 mã hóa thành ECMA-402. Các thư viện như Luxon [và các thư viện khác] tận dụng lợi thế này, giảm hoặc loại bỏ nhu cầu gửi các tệp dữ liệu của riêng bạn

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

  • địa phương. Các tệp dữ liệu tùy chỉnh thông qua mô-đun bổ trợ
  • Múi giờ. Các tệp dữ liệu tùy chỉnh thông qua mô-đun bổ trợ

Không có thư viện

JavaScript luôn có đối tượ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'
  }]
}];
74, đặc tả ECMAScript [ECMA-262] được xác định tại đây

Khi sử dụng các đối tượ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'
  }]
}];
74, hãy lưu ý những điều sau

  • Đối tượ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'
      }]
    }];
    
    74 bên trong đại diện cho dấu thời gian Unix với độ chính xác đến mili giây. Nó cung cấp các chức năng sẽ chuyển đổi sang và từ múi giờ địa phương của hệ thống, nhưng bên trong nó luôn là UTC. Không giống như đối tượ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'
      }]
    }];
    
    81, nó không thể được đặt để sử dụng múi giờ khác;

  • Việ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'
      }]
    }];
    
    82 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'
      }]
    }];
    
    83 đã gặp sự cố và được triển khai không nhất quán trong quá khứ. Thông số kỹ thuật hiện tại xác định phân tích cú pháp một biến thể của các chuỗi ISO 8601, trong đó các biểu mẫu chỉ có ngày [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'
      }]
    }];
    
    84] được phân tích cú pháp thành UTC, thay vì giờ địa phương như theo tiêu chuẩn ISO 8601. Ngay cả khi đó, không phải tất cả các triển khai hiện đại đều triển khai chính xác đặc điểm kỹ thuật này [e. g. , Cuộc đi săn]. Các loại chuỗi khác có thể hoạt động, nhưng việc phân tích cú pháp chúng là triển khai cụ thể và có thể thay đổi đáng kể - đặc biệt là với các trình duyệt cũ hơn. Tùy thuộc vào cách triển khai và các thành phần được cung cấp trong chuỗi, bạn có thể ngạc nhiên với kết quả. Vì những lý do này, chúng tôi đồng ý với tuyên bố của MDN rằng việc phân tích chuỗi bằng đối tượ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'
      }]
    }];
    
    74 không được khuyến khích

Các môi trường JavaScript hiện đại cũng sẽ triển khai đặc tả by ECMA-402, cung cấp đối tượ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 và xác định các tùy chọn hành vi của các 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'
  }]
}];
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 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'
  }]
}];
90 của đối tượ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'
  }]
}];
74

Khi sử dụng đối tượ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, hãy lưu ý những điều sau

  • Không phải mọi môi trường sẽ triển khai thông số kỹ thuật đầy đủ. Đặc biệt, nút. js yêu cầu hỗ trợ quốc tế hóa do ICU cung cấp. Xem nút. js để biết thêm chi tiết
  • Bảng tương thích ECMAScript Intl [của kangax] có thể hữu ích trong việc xác định tính năng nào được hỗ trợ và tính năng nào không
  • Hầu hết các môi trường mới hơn đều cung cấp hỗ trợ múi giờ IANA thông qua 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'
      }]
    }];
    
    92 trong hàm tạ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'
      }]
    }];
    
    93 [và 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'
      }]
    }];
    
    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 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'
      }]
    }];
    
    96]. Tùy chọn này có thể được sử dụng để lấy dấu thời gian dựa trên UTC nội bộ của đối tượ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'
      }]
    }];
    
    74 và nhận chuỗi đã được chuyển đổi thành múi giờ được đặt tên. Tuy nhiên, nó không thể được sử dụng để chuyển đổi đối tượ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'
      }]
    }];
    
    74 sang múi giờ khác

Nếu các đối tượ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'
  }]
}];
74 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'
  }]
}];
68 đáp ứng nhu cầu của bạn và bạn hoàn toàn hiểu những hạn chế của chúng, thì bạn có thể cân nhắc sử dụng chúng trực tiếp

Tương lai

chỉnh sửa

Tạm thời - Ngày và giờ tốt hơn bằng ngôn ngữ JavaScript

Một ngày không xa, chúng tôi hy vọng sẽ không còn nhu cầu lớn về thư viện ngày và giờ trong JavaScript nữa. Thay vào đó, chúng tôi sẽ có thể sử dụng các khả năng của chính ngôn ngữ JavaScript. Mặc dù một số chức năng hiện có ở đây 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'
  }]
}];
74 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'
  }]
}];
68, nhưng từ kinh nghiệm và dữ liệu, chúng tôi biết rằng vẫn còn nhiều chỗ cần cải thiện

Nỗ lực tạo API ngày và giờ tốt hơn bằng ngôn ngữ JavaScript đang được thực hiện thông qua Đề xuất tạm thời ECMA TC39. 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 sẽ là một đối tượng toàn cầu mới hoạt động như một không gian tên cấp cao nhấ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'
  }]
}];
604]. Nó hiển thị nhiều loại đối tượng riêng biệt bao gồ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'
  }]
}];
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 và một số đối tượng khác. Sách dạy nấu ăn tạm thời hiển thị nhiều "công thức nấu ăn" với các ví dụ về cách sử dụng các đồ vật này trong các tình huống khác nhau

Bạn có thể dùng thử Temporal ngay hôm nay, thông qua một polyfill phi sản xuất. Vui lòng dùng thử, nhưng đừng sử dụng nó trong sản xuất [chưa]

Vui lòng cung cấp phản hồi và cân nhắc đóng góp cho nỗ lực này - đặc biệt nếu bạn có kinh nghiệm sử dụng Khoảnh khắc hoặc các thư viện ngày và giờ khác

Yêu cầu. js

chỉnh sửa

Chúng tôi thực sự khuyên bạn nên đọc phần này nếu bạn định sử dụng khoảnh khắc với Yêu cầu. js. Cũng nâng cấp lên 2. 14. 0 trở lên để có trải nghiệm tốt nhất

Khi bắt đầu, bạn có thể có được khoảnh khắc thông qua bower hoặc node_modules hoặc bất kỳ thứ gì khác đặt khoảnh khắc. js cùng với thư mục ngôn ngữ trong thư mục cơ sở. 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. Browser support for parsing strings is inconsistent. 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

For consistent results parsing anything other than ISO 8601 strings, you should use String + Format

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

A time part can also be included, separated from the date part by a space or an uppercase 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'
  }]
}];
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

If a time part is included, an offset from UTC can also be included 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,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 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

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

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

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

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

    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ú. Support for the week and ordinal formats was added in version 2. 3. 0

If a string does not match any of the above formats and is not able to be parsed 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'
  }]
}];
82,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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'
  }]
}];
0

The RFC 2822 date time format

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ệ

After cleansing, the string is validated in the following space-separated sections, all using the English language

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

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

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

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

    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. Day of Week in three letters, followed by an optional comma. [optional]
  2. Day of Month [1 or 2 digit], followed by a three-letter month and 2 or 4 digit year
  3. Hai chữ số giờ và phút cách nhau bởi dấu hai chấm [. ], followed optionally by another colon and seconds in 2-digits
  4. Timezone or offset in one of the following formats
  5. UT. +0000
  6. giờ GMT. +0000
  7. EST. CST . MST . PST. EDT . CDT . MDT . PDT . US time zones*
  8. A - 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

String + Format 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

If you know the format of an input string, you can use that to parse a moment

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

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

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

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

    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'
  }]
}];
640Month 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'
  }]
}];
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'
  }]
}];
642Month 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'
  }]
}];
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'
  }]
}];
645Day of 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'
  }]
}];
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'
  }]
}];
647Day of month with ordinal
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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'
  }]
}];
649Day 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'
  }]
}];
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'
  }]
}];
651Unix timestamp
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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'
  }]
}];
653Unix ms timestamp

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

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

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

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

    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 hỗ trợ năm có 2 chữ số và chuyển đổi chúng thành năm gần 2000 [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'
  }]
}];
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 đã được thêm vào 2. 11. 1. Nó sẽ khớp với bất kỳ số nào, đã ký hoặc chưa ký. Nó hữu ích cho những năm không có 4 chữ số hoặc trước kỷ nguyên chung. Nó có thể được sử dụng cho bất kỳ năm nào

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

Đối với những điều này, mã thông báo chữ thường sử dụng ngày bắt đầu tuần nhận biết ngôn ngữ và mã thông báo chữ hoa sử dụng ngày bắt đầu ngày của tuần ISO

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

Các định dạng ngày và giờ nhận biết ngôn ngữ cũng có sẵn 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'
  }]
}];
676. Chúng đã được thêm vào trong phiên bản 2. 2. 1, ngoại 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'
  }]
}];
677 đã được thêm vào 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]

Mã thông báo giờ, phút, giây, mili giây và độ lệch

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

Từ phiên bản 2. 10. 5. mã thông báo thứ hai phân số có độ dài từ 4 đến 9 có thể phân tích cú pháp bất kỳ số lượng chữ số nào, nhưng sẽ chỉ xem xét 3 chữ số hàng đầu [mili giây]. Sử dụng nếu bạn có thời gian được in với nhiều chữ số phân số và muốn sử dụng đầu vào

Lưu ý rằng số lượng 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'
  }]
}];
711 được cung cấp chỉ liên quan khi phân tích cú pháp ở chế độ nghiêm ngặt. Ở chế độ tiêu chuẩ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'
  }]
}];
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 đều tương đương và được hiểu là phân số của giây. 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 đã được thêm vào trong phiên bản 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 were added in version 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 were added in version 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 were added in version 2. 13. 0

Unless you specify a time zone offset, parsing a string will create a date in the current time 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'
  }]
}];
6

Era Year related tokens

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'
  }]
}];
724Ordinal YearsN
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Era support was added in 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

As of version 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

For example, the following behavior can be observed

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

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

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

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

    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. Điều này đã được sửa 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'
  }]
}];
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. Strict parsing requires that the format and input match exactly, including delimeters

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

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

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

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

    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

You can use both locale and strictness

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

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

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

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

    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

Phân tích cú pháp nghiêm ngặt thường là tùy chọn phân tích cú pháp tốt nhất. Để 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

By default, two digit years above 68 are assumed to be in the 1900's and years 68 or below are assumed to be in the 2000's. This can be changed by replacing 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'
  }]
}];
733 method. The only argument of this method is a string containing the two years input by the user, and should return the year as an 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'
  }]
}];
63

Parsing glued hour and minutes

From version 2. 11. 0 parsing

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

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

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

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

    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 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'
  }]
}];
737 is supported

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

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

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

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

    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

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'
  }]
}];
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

Bắt đầu từ phiên bản 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
  • Thích các định dạng phân tích nhiều chuỗi hơn ít hơn và sử dụng nhiều định dạng hơn ít hơn, tô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

Mả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'
  }]
}];
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. Để tạo một ngày từ một mảng tại UTC, 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'
  }]
}];
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

Khi ở chế độ UTC, tất cả các phương thức hiển thị sẽ hiển thị theo giờ UTC thay vì giờ đị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'
  }]
}];
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

Để chuyển từ UTC sang giờ địa phương, bạn có thể sử dụng moment#utc hoặc 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. Ngày được tạo rõ ràng là không hợp lệ, 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'
      }]
    }];
    
    773. Boolean

Ngoài những điều trên, kể từ ngày 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. Cho biết kinh tuyến [AM/PM] nào đã được phân tích cú pháp, nếu có. 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. Trả về một mảng các phần ngày được phân tích cú pháp theo thứ tự giảm dần - i. e. parsedDateParts[0] === year. Nếu không có bộ phận nào, nhưng kinh tuyến có giá trị, thì ngày không hợp lệ. Mảng

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

Ghi chú. Khái niệm về giá trị của Moment trở nên chặt chẽ và nhất quán hơn giữa 2. 2 và 2. 3. Ghi chú. Validity is determined on moment creation. Một khoảnh khắc sửa đổi [tô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

Ngoài ra, bạn có thể 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'
  }]
}];
779 để xác định đơn vị ngày nào bị trà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'
  }]
}];
95

Giá trị trả về có ý nghĩa như sau

  1. năm
  2. tháng
  3. ngày
  4. hours
  5. phút
  6. seconds
  7. mili giây

Ghi chú. In case of multiple wrong units the first one is returned [because days validity may depend on month, for example]

Khoảnh khắc không hợp lệ

Nếu một khoảnh khắc không hợp lệ, nó sẽ hoạt động giống như một NaN trong các phép toán dấu phẩy động

Tất cả những điều sau đây tạo ra những khoảnh khắc 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'
      }]
    }];
    
    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 có tất cả các giá trị được đặt 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'
      }]
    }];
    
    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 trả về giá trị rỗ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'
      }]
    }];
    
    901 trả về giá trị rỗng [Kể từ ngày 2. 18. 0]

Thê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'
  }]
}];
96

Mutates the original moment by adding time

Đây là một chức năng khá mạnh mẽ để thêm thời gian vào một thời điểm hiện có. Để thêm thời gian, hãy nhập khóa thời gian bạn muốn thêm và số lượng bạn muố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'
  }]
}];
97

Cũng có một số phím tốc ký nếu bạn thích toàn bộ thứ ngắn gọ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'
  }]
}];
98KeyShorthandyearsyquartersQmonthsMweekswdaysdhourshminutesmsecondssmillisecondsms

Nếu bạn muốn thêm nhiều khóa khác nhau cùng một lúc, bạn có thể chuyển chúng vào dưới dạng đối tượng bằng 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'
  }]
}];
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

Cân nhắc đặc biệt cho các tháng và năm

Nếu ngày trong tháng của ngày ban đầu lớn hơn số ngày trong tháng cuối cùng, thì ngày trong tháng sẽ thay đổi thành ngày cuối cùng trong tháng cuối cù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'
  }]
}];
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

Thêm một tháng sẽ thêm số tháng đã chỉ định vào 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'
  }]
}];
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

Nếu bạn đang thêm giờ, phút, giây hoặc mili giây, giả định là bạn muốn độ chính xác của giờ và sẽ dẫn đến một giờ 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'
  }]
}];
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. Nó không được dùng nữa để ủng hộ
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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

kể từ 2. 12. 0 khi các giá trị thập phân được chuyển cho ngày và tháng, chúng được làm tròn thành số nguyên gần nhất. Tuần, quý và năm được chuyển đổi thành ngày hoặc tháng, sau đó được làm tròn thành số nguyên gần 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'
  }]
}];
07

Thời gian bắt đầu 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 đã 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'
  }]
}];
935

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'
  }]
}];
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 sử dụng ngày bắt đầu tuần nhận biết ngôn ngữ

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'
  }]
}];
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

Get or set the UTC offset in minutes

Note. 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

Setting the UTC offset by supplying minutes. 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. If you are wanting to set the offset globally, try using moment-timezone. Note that once you set an offset, it's fixed and won't change on its own [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

If the input is less than

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

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

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

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

    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 and greater than
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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, it will interpret your input as hours instead

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

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

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

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

    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 will search the string for the last match 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'
  }]
}];
948, so you can even pass an ISO8601 formatted string with offset and the moment will be changed to that UTC offset

Note that if the string does not include 'Z', it must include 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'
  }]
}];
949 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'
  }]
}];
950 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'
  }]
}];
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

  • 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'
      }]
    }];
    
    903 [the default] will keep the same instant in Universal Time, but the local time will change

  • 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ế

One use of this feature is if you want to construct a moment with a specific time zone offset using only numeric input 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'
  }]
}];
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

This is the most robust display option. 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 . Tháng 11 Tháng 12MMMMTháng 1 Tháng 2. November DecemberQuarterQ1 2 3 4Qo1st 2nd 3rd 4thDay of MonthD1 2 . 30 31Do1thứ 2. 30th 31stDD01 02 . 30 31 Ngày trong năm DD1 2. 364 365DDDo 1st 2nd. 364th 365thDDDD001 002 . 364 365Day of Weekd0 1 . 5 6do0th 1. 5th 6ddSu Mo. Fr SadddSun Mon . Fri SatddddSunday Monday . Thứ sáu Thứ bảyNgày trong tuần [Ngôn ngữ]e0 1. 5 6Day of Week [ISO]E1 2 . 6 7Tuần trong nămw1 2. 52 53wo1st 2nd . thứ 52 thứ 53ww01 02. 52 53Week of Year [ISO]W1 2 . 52 53Wo1st 2nd. Thứ 52 Thứ 53WW01 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
Lưu ý. Điều này tuân thủ tiêu chuẩn ISO 8601 cho các ngày sau năm 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 PMMaam pmHourH0 1. 22 23HH00 01 . 22 23h1 2 . 11 12hh01 02. 11 12k1 2. 23 24kk01 02. 23 24Minutem0 1 . 58 59mm00 01. 58 59Giây0 1. 58 59ss00 01 . 58 59Phân Số GiâyS0 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, the z/zz format tokens have been deprecated from plain moment objects. 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 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'
  }]
}];
960 were added in 2. 13. 0

Localized formats

Because preferred formatting differs based on locale, there are a few tokens that can be used to format a moment based on its locale

There are upper and lower case variations on the same formats. The lowercase version is intended to be the shortened version of its uppercase counterpart

TimeLT8. 30 PMTime with secondsLTS8. 30. 25 PMMonth numeral, day of month, yearL09/04/1986l9/4/1986Month name, day of month, yearLLSeptember 4, 1986llSep 4, 1986Month name, day of month, year, timeLLLSeptember 4, 1986 8. 30 PMlllSep 4, 1986 8. 30 PMMonth name, day of month, day of week, year, timeLLLLThursday, September 4, 1986 8. 30 PMllllThu, ngày 4 tháng 9 năm 1986 8. 30 PM

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

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

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

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

    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 are available 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'
  }]
}];
677 was added in 2. 8. 4

Escaping characters

To escape characters in format strings, you can wrap the characters in square brackets

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

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

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

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

    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

Similarities and differences with LDML

Note. While these date formats are very similar to LDML date formats, there are a few minor differences regarding day of month, day of year, and day of week

For a breakdown of a few different date formatting tokens across different locales, see this chart of date formatting tokens

Formatting speed

To compare Moment. 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

Other tokens

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/moment-strftime

định dạng mặc định

Calling

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

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

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

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

    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 without a format will default 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'
  }]
}];
964. Out of the box,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 is the ISO8601 format
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

As of version 2. 13. 0, when in UTC mode, the default format is governed 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'
  }]
}];
967 which is in the format
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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. This returns
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 as the offset, 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'
  }]
}];
970

In certain instances, a local timezone [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'
  }]
}];
971] may have a zero offset, and will be considered to be UTC. In such cases, it may be useful to set
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 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'
  }]
}];
967 to use the same formatting

Changing the value 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'
  }]
}];
964 will only affect formatting, and will not affect parsing. 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

Time from now 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

A common way of displaying time is handled 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'
  }]
}];
975. This is sometimes called timeago or relative 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'
  }]
}];
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

The base strings are customized by the current locale. Time is rounded to the nearest second

The breakdown of which string is displayed for each length of time is outlined in the table below

RangeKeySample Output0 to 44 secondssa few seconds agounsetss44 seconds ago45 to 89 secondsma minute ago90 seconds to 44 minutesmm2 minutes ago . 44 minutes ago45 to 89 minuteshan hour ago90 minutes to 21 hourshh2 hours ago . 21 hours ago22 to 35 hoursda day ago36 hours to 25 daysdd2 days ago . 25 days ago26 to 45 daysMa month ago45 to 319 daysMM2 months ago . 10 months ago320 to 547 days [1. 5 years]ya year ago548 days+yy2 years ago . 20 years ago

Note. From version 2. 10. 3, if the target moment object is invalid the result is the localized Invalid date string

Note. 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'
  }]
}];
977 key was added in 2. 18. 0. It is an optional threshold. It will never display UNLESS the user manually sets the ss threshold. Until 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'
  }]
}];
977 threshold is set, it defaults to the value 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'
  }]
}];
979 threshold minus 1 [so, invisible to the user]

Time to now 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

A common way of displaying time is handled 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'
  }]
}];
980. This is sometimes called timeago or relative time

This is similar 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'
  }]
}];
981, but gives the opposite interval.
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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

This is similar 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'
  }]
}];
983, but is special-cased for the current time. 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'
  }]
}];
983, if you want to control the two end points of the interval

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

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

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

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

    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

If you pass

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

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

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

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

    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, you can get the value without the prefix

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

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

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

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

    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

The base strings are customized by the current locale

The breakdown of which string is displayed for each length of time is outlined in the table below

RangeKeySample Output0 to 44 secondssin seconds45 to 89 secondsmin a minute90 seconds to 44 minutesmmin 2 minutes . in 44 minutes45 to 89 minuteshin an hour90 minutes to 21 hourshhin 2 hours . in 21 hours22 to 35 hoursdin a day36 hours to 25 daysddin 2 days . in 25 days26 to 45 daysMin a month45 to 319 daysMMin 2 months . in 10 months320 to 547 days [1. 5 years]yin a year548 days+yyin 2 years . in 20 years

From version 2. 10. 3, if the target moment object is invalid the result is the localized Invalid date string

Calendar Time 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

Calendar time displays time relative to a given

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

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

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

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

    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 [defaults to the start of today], but does so slightly differently than
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 will format a date with different strings depending on how close 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'
  }]
}];
986's date [today by default] the date is

Last weekLast Monday at 2. 30 AMThe day beforeYesterday at 2. 30 AMThe same dayToday at 2. 30 AMThe next dayTomorrow at 2. 30 AMThe next weekSunday at 2. 30 AMEverything else7/10/2011

These strings are localized, and can be customized

From 2. 10. 5 moment supports specifying calendar output formats per invocation

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

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

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

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

    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 is used as the format when the moment is more than a week away from 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'
  }]
}];
986

Note. From version 2. 14. 0 the formats argument to calendar can be a callback that is executed within the moment context with a single argument now

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

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

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

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

    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

Note. From version 2. 25. 0 you can only pass a formats argument, it could be an object of strings and functions

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

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

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

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

    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

Difference 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

To get the difference in milliseconds, 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'
  }]
}];
992 like you would 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'
  }]
}];
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

To get the difference in another unit of measurement, pass that measurement as the second argument

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

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

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

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

    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

To get the duration of a difference between two moments, you can pass

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

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

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

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

    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 as an argument into
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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. See the docs on moment#duration for more info

The supported measurements are

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

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

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

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

    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, 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'
  }]
}];
002. For ease of development, the singular forms are supported as of 2. 0. 0. Units of measurement other than milliseconds are available in version 1. 1. 1

By default,

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

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

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

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

    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 will truncate the result to zero decimal places, returning an integer. If you want a floating point number, pass
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 as the third argument. Before 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 returned a number rounded to the nearest integer, not a truncated 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'
  }]
}];
76

If the moment is earlier than the moment you are passing 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'
  }]
}];
006, the return value will be negative

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

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

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

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

    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

An easy way to think of this is by replacing

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

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

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

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

    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 with a minus operator

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

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

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

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

    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

Month and year diffs

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

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

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

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

    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 has some special handling for month and year diffs. It is optimized to ensure that two months with the same date are always a whole number apart

So Jan 15 to Feb 15 should be exactly 1 month

Feb 28 to Mar 28 should be exactly 1 month

Feb 28 2011 to Feb 28 2012 should be exactly 1 year

See more discussion on the month and year diffs here

This change to month and year diffs was made in 2. 0. 0. As of version 2. 9. 0 diff also support quarter unit

Is Before 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

Check if a moment is before another moment. The first argument will be parsed as a moment, if not already so

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

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

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

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

    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

If you want to limit the granularity to a unit other than milliseconds, pass the units as the second parameter

As the second parameter determines the precision, and not just a single value to check, using day will check for year, month and day

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

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

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

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

    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

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'
  }]
}];
009 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'
  }]
}];
010, any of the units of time that are supported for
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 are supported for
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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'
  }]
}];
02

If nothing is passed 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'
  }]
}];
012, it will default to the current time

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'
  }]
}];
014 has undefined behavior and should not be used. If the code runs fast the initial created moment would be the same as the one created in isBefore to perform the check, so the result would be
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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. But if the code runs slower it's possible that the moment created in isBefore is measurably after the one created 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'
  }]
}];
731, so the call would 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'
  }]
}];
953

Is Same 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

Check if a moment is the same as another moment. The first argument will be parsed as a moment, if not already so

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

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

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

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

    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

If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter

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

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

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

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

    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

When including a second parameter, it will match all units equal or larger. Passing 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'
  }]
}];
018 will check
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 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'
  }]
}];
020. Passing 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'
  }]
}];
021 will check
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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, 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'
  }]
}];
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

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'
  }]
}];
009 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'
  }]
}];
012, any of the units of time that are supported for
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 are supported for
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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

If the two moments have different timezones, the timezone of the first moment will be used for the comparison

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

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

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

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

    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

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'
  }]
}];
029 has undefined behavior and should not be used. If the code runs fast the initial created moment would be the same as the one created in isSame to perform the check, so the result would be
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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. But if the code runs slower it's possible that the moment created in isSame is measurably after the one created 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'
  }]
}];
731, so the call would 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

Is Between 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

Check if a moment is between two other moments, optionally looking at unit scale [minutes, hours, days, etc]. The match is exclusive. The first two arguments will be parsed as moments, if not already so

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

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

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

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

    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

Note that the order of the two arguments matter. the "smaller" date should be in the first argument

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

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

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

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

    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

If you want to limit the granularity to a unit other than milliseconds, pass the units as the third parameter

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

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

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

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

    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

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'
  }]
}];
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 any of the units of time that are supported for
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 are supported for
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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. Year, month, week, isoWeek, day, hour, minute, and second

Version 2. 13. 0 introduces inclusivity. 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'
  }]
}];
038 indicates inclusion of a value. 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ừ. If the inclusivity parameter is used, both indicators must be passed

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

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

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

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

    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

Note that in the event that 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'
  }]
}];
040 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'
  }]
}];
041 parameters are the same, but the inclusivity parameters are different, false will preside

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

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

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

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

    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

If the inclusivity parameter is not specified, Moment will default 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'
  }]
}];
042

Is Daylight Saving Time 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 checks if the current moment is in daylight saving time

NOTE. This function is a HACK. moment has no way of knowing if a given time is in actual DST or not. Some time changes in a zone are DST related, some are not, and without complete timezone information it can't know

Moment currently checks the winter and summer time, and if the offset matches the summer offset [and summer off is different than winter off], then it reports DST. This works in vast majority of cases, but as mentioned above, is not "correct" and won't work for all cases. So don't come to us complaining

Event moment-timezone [at moment of writing 0. 5. 37] doesn't support DST info [i. e is the clock officially in DST at a given moment or not], so for things to get better some new stuff [and tzdata bundling] has to happen in moment-timezone

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

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

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

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

    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

Changing locale globally 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

By default, Moment. js comes with English [United States] locale strings. If you need other locales, you can load them into Moment. js for later use

To load a locale, pass the key and the string values 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'
  }]
}];
044

More details on each of the parts of the locale bundle can be found in the customization section

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

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

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

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

    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

Once you load a locale, it becomes the active locale. To change active locales, simply call

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

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

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

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

    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 with the key of a loaded 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'
  }]
}];
09

As of 2. 21. 0, Moment will

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

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

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

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

    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 if the locale is unavailable

As of 2. 8. 0, changing the global locale doesn't affect existing instances

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

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

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

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

    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 returns the locale used. Đ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 will also try locale specifier substrings from most-specific to least-specific until it finds a locale it knows. Đ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

If you call

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

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

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

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

    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 with no parameters, you get back the locale configuration that would be used for that moment

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

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

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

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

    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

You can pass an integer into each of those functions to get a specific month or weekday

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

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

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

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

    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 you can pass a bool as the first parameter of the weekday functions. 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. In general, you should create a locale setting with your customizations

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

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

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

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

    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 đề cập đến tiền tố/hậu tố cho các ngày trong tương lai 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'
  }]
}];
076 đề cập đến tiền tố/hậu tố cho các ngày trong quá khứ. Đối với tất cả những người khác, một ký tự đơn đề cập đến số ít và một ký tự kép đề cập đến số nhiều

Nếu một ngôn ngữ yêu cầu xử lý bổ sung cho mã thông báo, thì nó có thể đặt mã thông báo làm hàm có chữ ký sau. 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

Đố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'
  }]
}];
077 đề cập đến khóa thay thế trong đối tượ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'
  }]
}];
073. [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'
  }]
}];
079, 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'
  }]
}];
080 đề cập đến số lượng đơn vị cho khóa đó. Đố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.

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'
  }]
}];
082 argument will be true if the token will be displayed without a suffix, and false if it will be displayed with a suffix. [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

KeyShorthandyearsymonthsMweekswdaysdhourshminutesmsecondssmillisecondsms

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ủ Đề