Tên tháng theo lịch 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ả 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. Thời điểm yêu cầu 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ô-đ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ó ở vị trí không chuẩn

Chuỗi 1. 0. 0+

chỉnh sửa

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

chỉnh sửa

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Bạn có thể nhận được kết quả không mong muốn khi phân tích cả ngày và giờ. The below example may not parse as you expect

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
630 từ phiên bản 2. 10. 5 hỗ trợ năm có 2 chữ số ở chế độ không phả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'
  }]
}];
632 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 was added in 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'
  }]
}];
658
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
667Day 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'
  }]
}];
669
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Các định dạng nhận biết ngôn ngữ

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'
  }]
}];
677. 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'
  }]
}];
678 đã đượ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'
  }]
}];
679
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
680Ngà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'
  }]
}];
681
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
682Tê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'
  }]
}];
683
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
684Tê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'
  }]
}];
685
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
686Ngà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'
  }]
}];
687
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
688Thờ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'
  }]
}];
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'
  }]
}];
690Thờ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

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
692Giờ [thời gian 24 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'
  }]
}];
693
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
640Giờ [thời gian 12 giờ được sử dụ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'
  }]
}];
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'
  }]
}];
696
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
697Giờ [thời gian 24 giờ từ 1 đến 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'
  }]
}];
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'
  }]
}];
699Chuỗi kinh tuyến hoặc ante meridiem [Lưu ý một 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'
  }]
}];
700 cũng được coi là 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'
  }]
}];
701
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
702Phú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'
  }]
}];
703
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
702Giâ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'
  }]
}];
705
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
706Giây phân 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'
  }]
}];
707
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
708 3708 Khoảng cách 36 UTC 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'
  }]
}];
,6 UTC32,

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'
  }]
}];
712 được cung cấp chỉ liên quan khi phân tích cú pháp ở chế độ nghiêm ngặt. In standard mode,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

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

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

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

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

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

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

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

    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 are all equivalent, and interpreted as fractions of a second. 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'
  }]
}];
717 luôn là 120 mili giây, việc chuyển sang
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    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 sẽ không khiến nó được hiểu là 12 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'
  }]
}];
707 đã đượ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'
  }]
}];
720 đã được thêm vào trong phiên bản 1. 6. 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Ghi chú và gotchas

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
732 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'
  }]
}];
733

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

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

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

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

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

Trình phân tích cú pháp của Moment rất dễ tha thứ và điều này có thể dẫn đến hành vi không mong muốn/không mong muốn

Ví dụ, hành vi sau đây có thể được quan sát

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

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

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

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

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

Trước 2. 13. 0 trình phân tích cú pháp thể hiện hành vi sau. Đ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. Phân tích cú pháp nghiêm ngặt yêu cầu định dạng và đầu vào khớp chính xác, bao gồm cả dấu phân cách

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

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

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

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

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

Bạn có thể sử dụng cả ngôn ngữ và độ nghiêm ngặt

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

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

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

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

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

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

Phân tích cú pháp hai chữ số năm

Theo mặc định, năm có hai chữ số trên 68 được coi là vào những năm 1900 và những năm từ 68 trở xuống được coi là vào những năm 2000. Điều này có thể được thay đổi bằng cách thay thế phương thức

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
734. Đối số duy nhất của phương thức này là một chuỗi chứa hai năm do người dùng nhập vào và sẽ trả về năm dưới dạng số nguyên

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

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

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

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

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

Phân tích cú pháp giờ và phút được dán

Từ phiên bản 2. 11. 0 phân tích cú pháp

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

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

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

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

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

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

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

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

    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 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'
  }]
}];
738 được hỗ trợ

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

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

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

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

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

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

Điều này giống như Chuỗi + Định dạng, chỉ khác là nó sẽ cố khớp đầu vào với nhiều định dạng

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

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

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

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

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

Bắt đầu từ phiên bản 2. 3. 0, Moment sử dụng một số phỏng đoán đơn giản để xác định định dạng nào sẽ sử dụng. theo thứ tự

  • Thích định dạng dẫn đến ngày hợp lệ hơn định dạng không hợp lệ
  • 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. thích phân tích cú pháp chặt chẽ hơn
  • Thích các định dạng sớm hơn trong mảng hơn sau nà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'
  }]
}];
67

Bạn cũng có thể chỉ định một đối số miền địa phương và nghiêm ngặt. Chúng hoạt động giống như trường hợp định dạng duy 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'
  }]
}];
68

Ghi chú. Phân tích cú pháp nhiều định dạng chậm hơn đáng kể so với phân tích cú pháp một định dạng. Nếu bạn có thể tránh nó, việc phân tích cú pháp một định dạng sẽ nhanh hơn nhiều

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

Bạn có thể tạo một khoảnh khắc với một dãy số phản ánh các tham số được truyền cho 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'
  }]
}];
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'
  }]
}];
70

Bất kỳ giá trị nào trong năm qua là tùy chọn và sẽ mặc định là số thấp nhất 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'
  }]
}];
71

Xây dựng với một mảng sẽ tạo ra một ngày trong múi giờ hiện tại. Để 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'
  }]
}];
740

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

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

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

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

    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

Ghi chú. Bởi vì điều này phản ánh các tham số 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'
  }]
}];
74, tháng, giờ, phút, giây và mili giây đều được lập chỉ mục bằng 0. Năm và ngày trong tháng được lập chỉ mục 1

Đây thường là nguyên nhân gây ra sự thất vọng, đặc biệt là với các tháng, vì vậy hãy lưu ý

Nếu ngày được đại diện bởi mảng 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'
  }]
}];
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

Theo mặc định, thời điểm phân tích cú pháp và hiển thị theo giờ địa phương

Nếu bạn muốn phân tích cú pháp hoặc hiển thị một thời điểm theo giờ UTC, 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'
  }]
}];
733 thay vì
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

Điều này đưa chúng ta đến một tính năng thú vị của Moment. js. chế độ UTC

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

Ngoài ra, khi ở chế độ UTC, tất cả getters và setters sẽ sử dụng nội bộ các 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'
  }]
}];
745 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'
  }]
}];
746 thay vì các 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'
  }]
}];
747 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'
  }]
}];
748

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

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

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

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

    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

Điều quan trọng cần lưu ý là mặc dù các màn hình khác nhau ở trên, nhưng cả hai đều có cùng 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'
  }]
}];
77

Bất kỳ thời điểm nào được tạo bằng

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
733 sẽ ở chế độ UTC và bất kỳ thời điểm nào được tạo bằng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

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

Các hàm phân tích chuỗi của Moment 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'
  }]
}];
751 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'
  }]
}];
752 chấp nhận thông tin offset nếu được cung cấp, nhưng chuyển đổi đối tượng Moment kết quả thành thời gian cục bộ hoặc UTC. Ngược lại,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
753 phân tích cú pháp chuỗi nhưng giữ đối tượng Khoảnh khắc kết quả trong múi giờ có độ lệch cố định với độ lệch được cung cấp trong 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'
  }]
}];
90

Nó cũng cho phép bạn chuyển các đối số miền địa phương và mức độ nghiêm ngặt

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
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'
  }]
}];
754 tương đương với việc phân tích cú pháp chuỗi và 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'
  }]
}];
755 để phân tích vù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'
  }]
}];
92

Xác thực 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 áp dụng các quy tắc khởi tạo chặt chẽ hơn 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'
  }]
}];
74

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

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

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

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

    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

Bạn có thể kiểm tra xem Khoảnh khắc có coi ngày không hợp lệ hay không 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'
  }]
}];
628. Bạn có thể kiểm tra các số liệu được sử dụng 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'
  }]
}];
758 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'
  }]
}];
759, trả về một đối tượng

Các cờ phân tích cú pháp sau dẫn đến một ngày 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'
      }]
    }];
    
    760. Trường ngày bị tràn, chẳng hạn như tháng thứ 13, ngày thứ 32 của tháng [hoặc ngày 29 tháng 2 đối với các năm không nhuận], ngày thứ 367 của năm, v.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'
      }]
    }];
    
    760 chứa chỉ mục của đơn vị không hợp lệ để khớp 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'
      }]
    }];
    
    762 [xem 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'
      }]
    }];
    
    764. Tên tháng 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'
      }]
    }];
    
    765. Chứa chính chuỗi tháng không hợp lệ, nếu không thì 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'
      }]
    }];
    
    766. Một chuỗi đầu vào không chứa gì có thể phân tích cú pháp, 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'
      }]
    }];
    
    767. 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'
      }]
    }];
    
    768. Một đầu và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'
      }]
    }];
    
    769, 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'
      }]
    }];
    
    770. 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'
      }]
    }];
    
    771. Một danh sách định dạng trố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'
      }]
    }];
    
    772. 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'
      }]
    }];
    
    773. Một 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'
      }]
    }];
    
    774. Boolean

Ngoài những điều trên, kể từ ngày 2. 13. 0, các cờ meridiem và parsedDateParts hoạt động cùng nhau để xác định tính hợp lệ của 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'
      }]
    }];
    
    775. Cho biết kinh tuyến [AM/PM] nào đã được phân tích cú pháp, nếu có. 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'
      }]
    }];
    
    776. 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] === năm. 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

Ngoài ra, nếu Khoảnh khắc được phân tích cú pháp ở chế độ nghiêm ngặt, các cờ này phải trống để Khoảnh khắc 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'
      }]
    }];
    
    777. mảng các chuỗi con định dạng không tìm thấy trong chuỗi đầu và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'
      }]
    }];
    
    778. mảng các chuỗi con đầu vào không khớp với chuỗi định dạng

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ú. Hiệu lực được xác định khi tạo thời điểm. 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'
  }]
}];
779] sẽ vẫn có hiệu lực

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'
  }]
}];
780 để 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. giờ
  5. phút
  6. giây
  7. mili giây

Ghi chú. Trong trường hợp có nhiều đơn vị sai, đơn vị đầu tiên được trả lại [ví dụ: vì hiệu lực của ngày có thể phụ thuộc vào tháng]

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'
      }]
    }];
    
    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
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        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

Sau đây tạo ra một 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'
  }]
}];
793

  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        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 dẫn đến
    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    795 ở địa phươ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'
      }]
    }];
    
    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
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        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 [Trước 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'
      }]
    }];
    
    903

Sự trở lại 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'
  }]
}];
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
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    921

Và những thứ này trả về

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
769 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'
  }]
}];
923 với một số cấu trú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'
      }]
    }];
    
    924 trả về giá trị rỗng, như tất cả các getters có tên 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'
      }]
    }];
    
    925
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    926 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'
      }]
    }];
    
    923
  • // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        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 trả về một đối tượng Ngày 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'
      }]
    }];
    
    929 trả về 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'
      }]
    }];
    
    931 trả về 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'
      }]
    }];
    
    902 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

Thay đổi khoảnh khắc ban đầu bằng cách thêm thời gian

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

Không có giới hạn trên cho số tiền, vì vậy bạn có thể quá tải bất kỳ tham số 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'
  }]
}];
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

Ngoài ra còn có những cân nhắc đặc biệt cần lưu ý khi thêm thời gian vượt qua thời gian tiết kiệm ánh sáng ban ngày. Nếu bạn thêm năm, tháng, tuần hoặc ngày, thì giờ ban đầu sẽ luôn khớp với giờ đã thêm

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

Ngoài ra, bạn có thể sử dụng thời lượng để thêm vào khoảnh khắc

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

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

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

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

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

Trước phiên bản 2. 8. 0, cú pháp

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
933 cũng được hỗ trợ. 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'
  }]
}];
934

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

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

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

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

    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

Thay đổi khoảnh khắc ban đầu bằng cách đặt nó ở đầu một đơn vị 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'
  }]
}];
09

Các phím tắt này về cơ bản giống như 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'
  }]
}];
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

Kể từ 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'
  }]
}];
935 đã 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'
  }]
}];
936

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'
  }]
}];
937 đã được thêm vào trong phiên bản 2. 0. 0

Kể từ phiên bản 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'
  }]
}];
937 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'
  }]
}];
939 đã được thêm vào trong phiên bản 2. 2. 0

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'
  }]
}];
940 đã được thêm làm bí danh cho ngày thứ 2. 13. 0

Bù UTC 2. 9. 0++

chỉnh sửa

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

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

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

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

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

Nhận hoặc đặt phần bù UTC sau vài phút

Ghi chú. Không giống như

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
941, 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'
  }]
}];
942]

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'
  }]
}];
943 của đối tượng hiện tại

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

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

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

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

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

Đặt phần bù UTC bằng cách cung cấp số phút. Phần bù được đặt trên đối tượng thời điểm mà

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
944 được gọi trên. Nếu bạn muốn đặt phần bù trên toàn cầu, hãy thử sử dụng múi giờ. Lưu ý rằng khi bạn đặt giá trị bù, giá trị đó sẽ cố định và sẽ không tự thay đổi [i. e không có quy tắc DST]. Nếu bạn muốn múi giờ thực -- 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'
  }]
}];
945, hãy xem xét múi giờ-thời điểm

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

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

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

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

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

Nếu đầu vào nhỏ hơn

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

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

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

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

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
947, thay vào đó, nó sẽ hiểu thông tin đầu vào của bạn là giờ

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

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

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

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

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

Cũng có thể đặt độ lệch UTC từ một chuỗi

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

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

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

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

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

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
755 sẽ tìm kiếm chuỗi cho trận đấu cuối cùng của
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
949, do đó, bạn thậm chí có thể chuyển một chuỗi được định dạng ISO8601 với độ lệch và thời điểm sẽ được thay đổi thành độ lệch UTC đó

Lưu ý rằng nếu chuỗi không bao gồm 'Z', nó phải bao gồm ký tự

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
950 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'
  }]
}];
951

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

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

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

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

    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'
  }]
}];
943 có tham số thứ hai tùy chọn chấp nhận giá trị boolean cho biết có giữ thời gian hiện có trong ngày hay không

  • Vượt qua

    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    904 [mặc định] sẽ giữ nguyên thời gian trong Giờ quốc tế, nhưng giờ địa phương sẽ thay đổi

  • Vượt qua

    // only needing core
    define[['moment'], function [moment] {
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    }];
    
    // core with single locale
    define[['moment', 'moment/locale/de'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // core with all locales
    define[['moment/min/moment-with-locales'], function [moment] {
        moment.locale['de'];
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
    }];
    
    // async load locale
    define[['require', 'moment'], function[require, moment] {
      // Inside some module after the locale is detected. This is the
      // case where the locale is not known before module load time.
      require[['moment/locale/de'], function[localeModule] {
        // here the locale is loaded, but not yet in use
        console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
    
        moment.locale['de'];
        // Use moment now that the locale has been properly set.
        console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
      }]
    }];
    
    954 sẽ giữ nguyên giờ địa phương, nhưng phải trả giá bằng việc chọn một điểm khác trong Giờ quốc tế

Một cách sử dụng tính năng này là nếu bạn muốn xây dựng một khoảnh khắc với độ lệch múi giờ cụ thể chỉ bằng các giá trị đầu vào số

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

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

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

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

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

Định dạng 1. 0. 0+

chỉnh sửa

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

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

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

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

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

Đây là tùy chọn hiển thị mạnh mẽ nhất. Nó nhận một chuỗi mã thông báo và thay thế chúng bằng các giá trị tương ứng

____620TokenOutputMonthM1 2. 11 12Mùng 1 Mùng 2. ngày 11 ngày 12MM01 02. 11 12MMMJan Feb. Tháng 11 Tháng 12MMMMTháng 1 Tháng 2. Tháng 11 Tháng 12 Quý 1 Quý 2 3 Quý 4 Quý 2 Ngày 3 Ngày 4 Tháng 1 2. 30 31Do1thứ 2. 30 ngày 31DD01 02. 30 31 Ngày trong năm DD1 2. 364 365DDDo 1st 2nd. 364th 365thDDDD001 002. 364 365Ngày trong tuần0 1. 5 6do0th 1. 5th 6ddSu Mo. Cha SadddChủ Nhật. Thứ Sáu SatddddChủ Nhật Thứ Hai. Thứ sáu Thứ bảyNgày trong tuần [Ngôn ngữ]e0 1. 5 6Ngày trong tuần [ISO]E1 2. 6 7Tuần trong nămw1 2. 52 53wo1thứ 2. thứ 52 thứ 53ww01 02. 52 53Tuần trong năm [ISO]W1 2. 52 53Wo1st 2nd. 52nd 53rdWW01 02 . 52 53NămYY70 71. 29 30YYYY1970 1971 . 2029 2030YYYYYY-001970 -001971 . +001907 +001971
Note. Expanded Years [Covering the full time value range of approximately 273,790 years forward or backward from 01 January, 1970]Y1970 1971 . 9999 +10000 +10001
Note. This complies with the ISO 8601 standard for dates past the year 9999Era Yeary1 2 . 2020 . EraN, NN, NNNBC AD
Note. Abbr era nameNNNNBefore Christ, Anno Domini
Note. Full era nameNNNNNBC AD
Note. Narrow era nameWeek Yeargg70 71 . 29 30gggg1970 1971. 2029 2030Week Year [ISO]GG70 71 . 29 30GGGG1970 1971 . 2029 2030AM/PMAAM PMaam pmHourH0 1 . 22 23HH00 01 . 22 23h1 2 . 11 12hh01 02 . 11 12k1 2 . 23 24kk01 02 . 23 24Minutem0 1 . 58 59mm00 01 . 58 59Seconds0 1 . 58 59ss00 01 . 58 59Fractional SecondS0 1 . 8 9SS00 01 . 98 99SSS000 001 . 998 999SSSS . SSSSSSSSS000[0. ] 001[0. ] . 998[0. ] 999[0. ]Time Zonez or zzEST CST . MST PST
Note. as of 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'
  }]
}];
956 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'
  }]
}];
716 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'
  }]
}];
959 were added in 2. 10. 5. They display 3 significant digits and the rest is filled with zeros

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

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

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

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

    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 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'
  }]
}];
961 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'
  }]
}];
962 có sẵn trong 2. 0. 0.
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

Nhân vật trốn thoát

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 formatting speed against other libraries, check out this comparison against other libraries

Các mã thông báo khác

Nếu bạn cảm thấy thoải mái hơn khi làm việc với strftime thay vì mã thông báo phân tích cú pháp giống như LDML, bạn có thể sử dụng plugin của Ben Oakes. benjaminoakes/moment-strftime

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

Gọi

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
629 không có định dạng sẽ mặc định là
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
965. Ngoài hộp, ________ 5965 là định dạng ISO 8601 ________ 5967

Kể từ phiên bản 2. 13. 0, khi ở chế độ UTC, định dạng mặc định được điều chỉnh bởi

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

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

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

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

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

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

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

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

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
626 làm phần bù, thay vì
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

Trong một số trường hợp nhất định, múi giờ địa phương [chẳng hạn như

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
972] có thể có độ lệch bằng 0 và sẽ được coi là UTC. Trong những trường hợp như vậy, có thể hữu ích khi đặt
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
965 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'
  }]
}];
968 để sử dụng cùng một định dạng

Thay đổi giá trị của

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
965 sẽ chỉ ảnh hưởng đến định dạng và sẽ không ảnh hưởng đến phân tích cú pháp. Ví dụ

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

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

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

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

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

Thời gian tính từ bây giờ 1. 0. 0+

chỉnh sửa

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

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

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

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

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

Một cách phổ biến để hiển thị thời gian được xử lý bởi

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
976. Điều này đôi khi được gọi là timeago hoặc thời gian tương đối

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

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

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

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

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

Nếu bạn vượt qua

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
954, bạn có thể nhận được giá trị mà không cần hậu tố

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

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

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

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

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

Các chuỗi cơ sở được tùy chỉnh theo ngôn ngữ hiện tại. Thời gian được làm tròn đến giây gần nhất

Bảng phân tích chuỗi nào được hiển thị trong mỗi khoảng thời gian được nêu trong bảng bên dưới

RangeKeySample Output0 đến 44 giâysa vài giây trướcunsetss44 giây trước45 đến 89 giâyma phút trước90 giây đến 44 phútmm2 phút trước. 44 phút trước45 đến 89 phútshan giờ trước90 phút đến 21 giờhh2 giờ trước. 21 giờ trước22 đến 35 giờda ngày trước36 giờ đến 25 ngàydd2 ngày trước. 25 ngày trước26 đến 45 ngàyMa tháng trước45 đến 319 ngàyMM2 tháng trước. 10 tháng trước320 tới 547 ngày [1. 5 năm] hoặc năm trước 548 ngày+yy2 năm trước. 20 năm trước

Ghi chú. Từ phiên bản 2. 10. 3, nếu đối tượng thời điểm đích không hợp lệ, kết quả là chuỗi ngày không hợp lệ được bản địa hóa

Ghi chú. Khóa

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
978 đã được thêm vào 2. 18. 0. Đó là một ngưỡng tùy chọn. Nó sẽ không bao giờ hiển thị TRỪ KHI người dùng đặt ngưỡng ss theo cách thủ công. Cho đến khi ngưỡng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
978 được đặt, nó sẽ mặc định là giá trị của ngưỡng
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
980 trừ đi 1 [do đó, người dùng không nhìn thấy được]

Đến giờ 2. 10. 3+

chỉnh sửa

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

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

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

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

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

Một cách phổ biến để hiển thị thời gian được xử lý bởi

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
981. Điều này đôi khi được gọi là timeago hoặc thời gian tương đối

Điều này tương tự với

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
982, nhưng đưa ra khoảng thời gian ngược lại.
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

Điều này tương tự như ________ 5984, nhưng là trường hợp đặc biệt cho thời điểm hiện tại. Sử dụng

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
984, nếu bạn muốn kiểm soát hai điểm cuối của khoảng thời gian

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

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

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

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

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

Nếu bạn vượt qua

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
954, bạn có thể nhận giá trị mà không cần tiền tố

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

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

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

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

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

Các chuỗi cơ sở được tùy chỉnh theo ngôn ngữ hiện tại

Bảng phân tích chuỗi nào được hiển thị trong mỗi khoảng thời gian được nêu trong bảng bên dưới

RangeKeySample Output0 đến 44 giây trong giây45 đến 89 giâyphút một phút90 giây đến 44 phútmmin 2 phút. trong 44 phút45 đến 89 phút hin một giờ90 phút đến 21 giờ hin 2 giờ. trong 21 giờ22 đến 35 giờ trong một ngày36 giờ đến 25 ngàyddin 2 ngày. trong 25 ngày26 đến 45 ngàyTối thiểu một tháng45 đến 319 ngàyMMTối thiểu 2 tháng. trong 10 tháng320 đến 547 ngày [1. 5 năm] âm một năm548 ngày+yyin 2 năm. Trong 20 năm

Từ phiên bản 2. 10. 3, nếu đối tượng thời điểm đích không hợp lệ, kết quả là chuỗi ngày không hợp lệ được bản địa hóa

Thời gian theo lịch 1. 3. 0+

chỉnh sửa

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

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

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

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

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

Thời gian theo lịch hiển thị thời gian tương ứng với một

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
987 nhất định [mặc định là bắt đầu từ ngày hôm nay], nhưng hiển thị hơi khác so với
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
989 sẽ định dạng một ngày với các chuỗi khác nhau tùy thuộc vào mức độ gần với ngày của
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
987 [theo mặc định là ngày hôm nay].

Tuần trước Thứ Hai tuần trước lúc 2. 30 Ngày hôm trước Hôm qua lúc 2. 30 Cùng ngày Hôm nay lúc 2. 30 AMNgày hôm sauNgày mai lúc 2. 30 AMTuần tớiChủ nhật lúc 2. 30 AMMọi thứ khác7/10/2011

Các chuỗi này được bản địa hóa và có thể được tùy chỉnh

từ 2. 10. 5 thời điểm hỗ trợ chỉ định định dạng đầu ra lịch cho mỗi lần gọi

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

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

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

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

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

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
991 được sử dụng làm định dạng khi thời điểm cách
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
987 hơn một tuần

Ghi chú. Từ phiên bản 2. 14. 0, đối số định dạng cho lịch có thể là lệnh gọi lại được thực thi trong ngữ cảnh thời điểm với một đối số duy nhất ngay bây giờ

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

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

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

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

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

Ghi chú. Từ phiên bản 2. 25. 0, bạn chỉ có thể truyền đối số định dạng, nó có thể là đối tượng của chuỗi và hàm

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

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

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

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

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

Sự khác biệt 1. 0. 0+

chỉnh sửa

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

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

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

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

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

Để có sự khác biệt tính bằng mili giây, hãy sử dụng

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Để có được sự khác biệt trong một đơn vị đo lường khác, hãy chuyển phép đo đó làm đối số thứ hai

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

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

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

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

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

Để có được khoảng thời gian chênh lệch giữa hai khoảnh khắc, bạn có thể chuyển

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
995 làm đối số thành
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
996. Xem tài liệu trên moment#duration để biết thêm thông tin

Các phép đo được hỗ trợ là

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

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

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

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

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

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

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

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

    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 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'
  }]
}];
003. Để dễ phát triển, các dạng số ít được hỗ trợ kể từ 2. 0. 0. Các đơn vị đo lường khác với mili giây có sẵn trong phiên bản 1. 1. 1

Theo mặc định,

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
993 sẽ cắt bớt kết quả đến 0 chữ số thập phân, trả về một số nguyên. Nếu bạn muốn một số dấu phẩy động, hãy chuyển
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
954 làm đối số thứ ba. trước 2. 0. 0,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
993 trả về một số được làm tròn thành số nguyên gần nhất, không phải số bị cắt bớt

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

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

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

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

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

Nếu thời điểm này sớm hơn thời điểm bạn chuyển đến

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
007, giá trị trả về sẽ là số âm

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

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

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

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

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

Một cách dễ dàng để nghĩ về điều này là thay thế

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
008 bằng một toán tử trừ

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

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

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

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

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

Tháng và năm khác nhau

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
993 có một số cách xử lý đặc biệt đối với chênh lệch tháng và năm. Nó được tối ưu hóa để đảm bảo rằng hai tháng có cùng ngày luôn cách nhau một số nguyên

Vì vậy, ngày 15 tháng 1 đến ngày 15 tháng 2 phải đúng 1 tháng

28/02 đến 28/03 chắc là đúng 1 tháng

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

Giống như

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
010 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'
  }]
}];
011, bất kỳ đơn vị thời gian nào được hỗ trợ cho
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
012 đều được hỗ trợ cho
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

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

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

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

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

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

    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'
  }]
}];
013, 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'
  }]
}];
015 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'
  }]
}];
904. 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'
  }]
}];
732, 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'
  }]
}];
954

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

Kiểm tra xem một khoảnh khắc có giống với một khoảnh khắc khác không. 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. Vượt qua trong

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

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

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

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

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

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
019 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'
  }]
}];
021. 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'
  }]
}];
022 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'
  }]
}];
022,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

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

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

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

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
019, 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'
  }]
}];
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'
  }]
}];
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'
  }]
}];
010 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'
  }]
}];
013, 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'
  }]
}];
012 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

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

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

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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

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'
  }]
}];
030 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'
  }]
}];
954. 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'
  }]
}];
732, 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'
  }]
}];
904

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

Lưu ý rằng thứ tự của hai đối số quan trọng. ngày "nhỏ hơn" phải ở đối số đầu tiên

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
01

Nếu bạn muốn giới hạn mức độ chi tiết ở một đơn vị khác với mili giây, hãy chuyển các đơn vị này làm tham số thứ ba

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
02

Giống như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
011,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
013,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
010 bất kỳ đơn vị thời gian nào được hỗ trợ cho
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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 đều được hỗ trợ cho
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
038. Năm, tháng, tuần, isoWeek, ngày, giờ, phút và giây

Phiên bản 2. 13. 0 giới thiệu tính toàn diện. Một

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
039 cho biết bao gồm một giá trị. Một
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
040 biểu thị loại trừ. Nếu tham số bao gồm được sử dụng, cả hai chỉ số phải được thông qua

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
03

Lưu ý rằng trong trường hợp các tham số

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
041 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'
  }]
}];
042 giống nhau, nhưng các tham số bao gồm khác nhau, sai sẽ chiếm ưu thế

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
04

Nếu tham số bao gồm không được chỉ định, Moment sẽ mặc định là

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
043

Là Giờ mùa hè 1. 2. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
05

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
044 kiểm tra xem thời điểm hiện tại có phải là giờ mùa hè không

GHI CHÚ. Chức năng này là một HACK. thời điểm không có cách nào để biết liệu một thời điểm nhất định có ở DST thực tế hay không. Một số thay đổi về thời gian trong một vùng có liên quan đến DST, một số thì không và không có thông tin múi giờ hoàn chỉnh thì không thể biết được

Khoảnh khắc hiện đang kiểm tra thời gian mùa đông và mùa hè, và nếu thời gian bù khớp với thời gian bù mùa hè [và thời gian nghỉ hè khác với thời gian nghỉ mùa đông], thì nó sẽ báo cáo DST. Điều này hoạt động trong phần lớn các trường hợp, nhưng như đã đề cập ở trên, không "chính xác" và sẽ không hoạt động trong mọi trường hợp. Vì vậy, đừng đến với chúng tôi phàn nàn

Múi giờ thời điểm sự kiện [tại thời điểm viết 0. 5. 37] không hỗ trợ thông tin DST [i. e có phải là đồng hồ chính thức trong DST tại một thời điểm nhất định hay không], vì vậy để mọi thứ trở nên tốt hơn, một số nội dung mới [và gói tzdata] phải diễn ra theo múi giờ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
06

Thay đổi ngôn ngữ trên toàn cầu 1. 0. 0+

chỉnh sửa

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
07

Theo mặc định, Khoảnh khắc. js đi kèm với chuỗi ngôn ngữ tiếng Anh [Hoa Kỳ]. Nếu bạn cần các ngôn ngữ khác, bạn có thể tải chúng vào Khoảnh khắc. js để sử dụng sau

Để tải một ngôn ngữ, hãy chuyển khóa và các giá trị chuỗi tới

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
045

Bạn có thể tìm thêm chi tiết về từng phần của gói ngôn ngữ trong phần tùy chỉnh

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
08

Thông tin chi tiết về

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
046 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'
  }]
}];
047 có thể được tìm thấy trong phần tùy chỉnh

Sau khi bạn tải một ngôn ngữ, nó sẽ trở thành ngôn ngữ hoạt động. Để thay đổi ngôn ngữ đang hoạt động, chỉ cần gọi

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
045 bằng khóa của ngôn ngữ đã tải

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
09

kể từ 2. 21. 0, Khoảnh khắc sẽ

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
049 nếu ngôn ngữ không khả dụng

kể từ 2. 8. 0, việc thay đổi ngôn ngữ chung không ảnh hưởng đến các phiên bản hiện có

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
10

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
045 trả về ngôn ngữ được sử dụng. Điều này hữu ích vì Khoảnh khắc sẽ không thay đổi ngôn ngữ nếu nó không biết ngôn ngữ bạn chỉ định

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
11

Bạn cũng có thể chỉ định một danh sách các ngôn ngữ và Moment sẽ sử dụng danh sách đầu tiên mà nó có bản địa hóa cho

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
12

Moment cũng sẽ thử các chuỗi con của trình xác định ngôn ngữ từ cụ thể nhất đến ít cụ thể nhất cho đến khi tìm thấy một ngôn ngữ mà nó biết. Điều này hữu ích khi cung cấp Khoảnh khắc bằng chuỗi ngôn ngữ được lấy từ môi trường của người dùng, chẳng hạn như

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
051

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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

A global locale configuration can be problematic when passing around moments that may need to be formatted into different 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'
  }]
}];
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'
  }]
}];
052 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

If you need to access the locale data for a moment, this is the preferred way to do so

As of 2. 3. 0, you can also specify an array of locale identifiers. It works the same way it does in the global locale configuration

Listing the months and weekdays of the current Moment. js locale 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

It is sometimes useful to get the list of months or weekdays in a locale, for example when populating a dropdown menu

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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

Returns the list of months 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'
  }]
}];
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'
  }]
}];
053 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'
  }]
}];
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,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
056 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

As of 2. 13. 0 you can pass a bool as the first parameter of the weekday functions. If true, the weekdays will be returned in locale specific order. For instance, in the Arabic locale, Saturday is the first day of the week, thus

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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

Note. Absent the locale specific parameter, weekdays always have Sunday as index 0, regardless of the local first day of the week

Some locales make special considerations into account when formatting month names. For example, Dutch formats month abbreviations without a trailing period, but only if it's formatting the month between dashes. 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'
  }]
}];
998 method supports passing a format in so that the months will be listed in the proper context

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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

And finally, you can combine both the format option and the integer option

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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

Accessing locale specific functionality 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

You can access the properties of the currently loaded locale through 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'
  }]
}];
058 function. 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

The returned object has the following 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'
  }]
}];
29

Details about

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
059 can be found in the customization section

Moment. js is very easy to customize. 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

You can remove a previously defined locale by 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'
  }]
}];
769 as the second argument. The deleted locale will no longer be available for 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'
  }]
}];
31

As of 2. 12. 0 it is possible to create a locale that inherits from a parent 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'
  }]
}];
32

Properties that are not specified in the locale will be inherited from the parent locale

As of 2. 16. 0 it is possible to define a locale with a parent that hasn't itself been defined or loaded

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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

As of 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. Failing that it will default the parent to the global locale

As of 2. 12. 0 it is also possible to update a locale's properties

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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

Any properties specified will be updated, while others will remain the same. This function does not affect moments that already exist. 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'
  }]
}];
061 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;

To revert an update 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'
  }]
}];
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ó. 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'
  }]
}];
063 instead

Month Names 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'
  }]
}];
064 should be an array of the month names

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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'
  }]
}];
064 có thể là một hàm có chữ ký sau. It should always return a month name

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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 months can also be an object, specifying

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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 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'
  }]
}];
067 forms [nominative and accusative]. The regular expression that is run on the format to check whether to 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'
  }]
}];
067 form is
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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. From version 2. 14. 0 a different one can be specified with the
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
070 key

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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

Weekday Names 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'
  }]
}];
071 should be an array of the weekdays names

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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'
  }]
}];
071 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

Note. Từ phiên bản 2. 11. 0 format/standalone cases can be passed as well.

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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 will be used against the full format string to determine which form to 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'
  }]
}];
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'
  }]
}];
074 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'
  }]
}];
994

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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'
  }]
}];
076 đề 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'
  }]
}];
077 đề 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. Hàm sẽ trả về 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'
  }]
}];
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'
  }]
}];
078 đề 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'
  }]
}];
074. [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'
  }]
}];
080, 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'
  }]
}];
081 đề cập đến số lượng đơn vị cho khóa đó. 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'
  }]
}];
082, the number is the number of minutes, etc

Đố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 mã thông báo sẽ được hiển thị mà không có hậu tố và sai nếu nó sẽ được hiển thị với hậu tố. [Lý do logic đảo ngược là vì hành vi mặc định là hiển thị với hậu tố. ]

Đối số

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
084 sẽ đúng nếu nó sẽ sử dụng tiền 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'
  }]
}];
085 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'
  }]
}];
086 đã đượ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'
  }]
}];
087 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'
  }]
}];
088 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'
  }]
}];
978,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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'
  }]
}];
093,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    moment.locale['de'];
    // Use moment now that the locale has been properly set.
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
  }]
}];
095

đơ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. wweeksleast number of weeks to be considered a month. 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'
  }]
}];
093 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'
  }]
}];
978 đã đượ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'
  }]
}];
098 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'
  }]
}];
099 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'
  }]
}];
100 đượ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'
  }]
}];
101 để 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'
  }]
}];
100 đượ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'
  }]
}];
103, 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'
  }]
}];
104 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

Specify Eras for a particular locale. 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'
  }]
}];
105 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'
  }]
}];
106 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'
  }]
}];
107, 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'
  }]
}];
108, 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'
  }]
}];
105 >
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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. Đối với các thời đại tăng dần về phía +Vô cực ________ 6105 < ________ 6106

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'
  }]
}];
113,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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 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'
  }]
}];
115

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'
  }]
}];
116 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'
  }]
}];
117 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'
  }]
}];
118 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'
  }]
}];
117, 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 style time spans. 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'
  }]
}];
120. 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'
  }]
}];
121. 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'
  }]
}];
122

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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'
  }]
}];
923 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'
  }]
}];
994 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'
  }]
}];
125

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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'
  }]
}];
126 [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'
  }]
}];
127,
// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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 [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'
  }]
}];
129

// only needing core
define[['moment'], function [moment] {
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'
}];

// core with single locale
define[['moment', 'moment/locale/de'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// core with all locales
define[['moment/min/moment-with-locales'], function [moment] {
    moment.locale['de'];
    console.log[moment[].format['LLLL']]; // 'Freitag, 24. Juni 2016 01:42'
}];

// async load locale
define[['require', 'moment'], function[require, moment] {
  // Inside some module after the locale is detected. This is the
  // case where the locale is not known before module load time.
  require[['moment/locale/de'], function[localeModule] {
    // here the locale is loaded, but not yet in use
    console.log[moment[].format['LLLL']];  // 'Friday, June 24, 2016 1:42 AM'

    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. To specify thresholds for a particular invocation of humanize, pass them as a sole argument or after suffix arg

Chủ Đề